Skip to content

Fix int.to_bytes specialization arg handling#13

Merged
BobTheBuidler merged 2 commits into
to-bytesfrom
temp/to-bytes
Jan 18, 2026
Merged

Fix int.to_bytes specialization arg handling#13
BobTheBuidler merged 2 commits into
to-bytesfrom
temp/to-bytes

Conversation

@BobTheBuidler

Copy link
Copy Markdown
Owner

Follow-up to python#19674.

This fixes the IR specializer for int.to_bytes so it parses positional/kw-only args correctly (including signed), and updates the IR build test expectation.

Tests:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -o addopts= mypyc/test/test_irbuild.py -k testIntToBytes
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -o addopts= mypyc/test/test_run.py -k run-integers

byteorder_expr = expr.args[1]
length_expr: Expression | None = None
byteorder_expr: Expression | None = None
signed_expr: Expression | None = None

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this logic should be encapsulated into a more generalizable arg-parser

perhaps I'll look into that for a future PR

@BobTheBuidler
BobTheBuidler merged commit c761f6b into to-bytes Jan 18, 2026
15 checks passed
@BobTheBuidler
BobTheBuidler deleted the temp/to-bytes branch January 18, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant