mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 11:14:38 +08:00
Fix int.from_bytes type
This commit is contained in:
1 parent
c335791e2f
commit
fc0c8fd59a
2 files changed
+7
-5
No files matched your search
@@ -601,8 +601,6 @@ class TypesTests(unittest.TestCase):
|
||||
self.assertIsInstance(object().__lt__, types.MethodWrapperType)
|
||||
self.assertIsInstance((42).__lt__, types.MethodWrapperType)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_method_descriptor_types(self):
|
||||
self.assertIsInstance(str.join, types.MethodDescriptorType)
|
||||
self.assertIsInstance(list.append, types.MethodDescriptorType)
|
||||
|
||||
@@ -531,9 +531,13 @@ impl PyInt {
|
||||
zelf
|
||||
}
|
||||
|
||||
#[pymethod]
|
||||
#[pyclassmethod]
|
||||
#[allow(clippy::match_bool)]
|
||||
fn from_bytes(args: IntFromByteArgs, vm: &VirtualMachine) -> PyResult<BigInt> {
|
||||
fn from_bytes(
|
||||
cls: PyClassRef,
|
||||
args: IntFromByteArgs,
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult<PyRef<Self>> {
|
||||
let signed = if let OptionalArg::Present(signed) = args.signed {
|
||||
signed.to_bool()
|
||||
} else {
|
||||
@@ -555,7 +559,7 @@ impl PyInt {
|
||||
)
|
||||
}
|
||||
};
|
||||
Ok(x)
|
||||
PyInt::new(x).into_ref_with_type(vm, cls)
|
||||
}
|
||||
|
||||
#[pymethod]
|
||||
|
||||
Reference in new issue
Block a user