Fix int.from_bytes type

This commit is contained in:
Jeong YunWon
2020-02-01 02:28:50 +09:00
parent c335791e2f
commit fc0c8fd59a
2 changed files with 7 additions and 5 deletions

View File

@@ -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)

View File

@@ -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]