forked from Rust-related/RustPython
Fix int.from_bytes type
This commit is contained in:
@@ -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