Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix int.from_bytes type
  • Loading branch information
youknowone committed Jan 31, 2020
commit fc0c8fd59aed73383bab184157e5cdc7d0eebe15
2 changes: 0 additions & 2 deletions Lib/test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,6 @@ def test_method_wrapper_types(self):
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)
Expand Down
10 changes: 7 additions & 3 deletions vm/src/obj/objint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -555,7 +559,7 @@ impl PyInt {
)
}
};
Ok(x)
PyInt::new(x).into_ref_with_type(vm, cls)
}

#[pymethod]
Expand Down