Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 439b44e

Browse filesBrowse files
committed
Add default parameters to to_bytes based on v3.11 standard
1 parent 887ffd1 commit 439b44e
Copy full SHA for 439b44e

File tree

1 file changed

+4
-2
lines changed
Filter options

1 file changed

+4
-2
lines changed

‎vm/src/builtins/int.rs

Copy file name to clipboardExpand all lines: vm/src/builtins/int.rs
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl PyInt {
614614
#[pymethod]
615615
fn to_bytes(&self, args: IntToByteArgs, vm: &VirtualMachine) -> PyResult<PyBytes> {
616616
let signed = args.signed.map_or(false, Into::into);
617-
let byte_len = args.length.try_to_primitive(vm)?;
617+
let byte_len = args.length;
618618

619619
let value = self.as_bigint();
620620
match value.sign() {
@@ -802,7 +802,9 @@ struct IntFromByteArgs {
802802

803803
#[derive(FromArgs)]
804804
struct IntToByteArgs {
805-
length: PyIntRef,
805+
#[pyarg(any, default = "1")]
806+
length: usize,
807+
#[pyarg(any, default = "ArgByteOrder::Big")]
806808
byteorder: ArgByteOrder,
807809
#[pyarg(named, optional)]
808810
signed: OptionalArg<ArgIntoBool>,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.