← Winnitude! Search  ·  Reader Mode (2224 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 92 LINKS

Update `opcode` from 3.13.7 by ShaharNaveh · Pull Request #6156 · RustPython/RustPython

Repository navigation

Update opcode from 3.13.7 - #6156


Merged
youknowone merged 16 commits into RustPython:main from ShaharNaveh:update-opcode Oct 5, 2025
Merged

Update opcode from 3.13.7 #6156 youknowone merged 16 commits into RustPython:main from ShaharNaveh:update-opcode

Conversation

ShaharNaveh commented Sep 17, 2025



Copy link Copy Markdown
Contributor

No description provided.

ShaharNaveh added 10 commits September 17, 2025 10:53 Update opcode from 3.13.7 fb44bc9 Base _opcode f14e623 Add test__opcode.py from 3.13.7 12aea60 Impl has_* methods 16b4eda Add more methods 7fe1032 Update dis.py from 3.13.7 b5b7534 Update support/bytecode_helper.py from 3.13.7 45ab229 correct is_valid 4224563 Patch failing tests af92d55 Unpatch support/__init__.py aa02f02

coderabbitai
Bot
commented Sep 17, 2025 · edited Loading



Copy link Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches 🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

ShaharNaveh added 6 commits September 18, 2025 01:55 clippy f629c7f Make comments to doc 56a0edb impl _varname_from_oparg for code 6b3c578 Unmark passing tests 2634c5f Revert changes to dis 98abe59 Mark failing tests a7b9356 ShaharNaveh changed the title Impl _opcode. Update dis from 3.13.7 Update opcode from 3.13.7 Sep 18, 2025 ShaharNaveh marked this pull request as ready for review September 18, 2025 14:53 ShaharNaveh requested a review from youknowone September 18, 2025 14:53 youknowone reviewed Sep 20, 2025
View reviewed changes
Comment thread stdlib/src/opcode.rs
Self::is_valid(opcode)
&& matches!(
opcode,
63 | 66

youknowone commented Sep 20, 2025



Copy link Copy Markdown
Member

finally we get _opcode, great!

ShaharNaveh mentioned this pull request Sep 23, 2025 Opcode metadata auto generation #6174 Closed youknowone reviewed Sep 25, 2025
View reviewed changes
Comment thread Lib/_opcode_metadata.py
'INSTRUMENTED_POP_JUMP_IF_FALSE': 251,
'INSTRUMENTED_POP_JUMP_IF_NONE': 252,
'INSTRUMENTED_POP_JUMP_IF_NOT_NONE': 253,
'JUMP': 256,
Comment thread stdlib/src/opcode.rs
Self::is_valid(opcode)
&& matches!(
opcode,
63 | 66

ShaharNaveh commented Sep 25, 2025 · edited Loading



Copy link Copy Markdown
Contributor

Author

For some reason I can't comment on the thread of #6156 (comment) so answering it here:

Does giving specific numbers to each instruction make it easier to be maintained? I guess so.

Yes! it also makes it easier for writing the helpers of:

  • is_valid
  • has_arg
  • has_const
  • has_name
  • etc...

but that wouldn't be needed as I intend #6174 to generate those automatically (just like CPython does it)

After #6174 , then can we rewrite 63 | 66 to Instruction::Abc as u8 | Instruction::Def as u8 and so on?

Well, yes you could. but I thought that we could have an API that looks similar to this:

// This is inside the `_opcode` module
fn has_arg(opcode: i32) -> bool {
  Instruction::try_from(opcode).map_or(false, |v| !v.is_pseudo() && v.has_arg())
}

where:

  • Instruction::try_from
  • instruction.is_pseudo()
  • instruction.has_arg()

are all auto generated.

youknowone approved these changes Oct 5, 2025
View reviewed changes

youknowone left a comment



Copy link Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good in general.

I am worrying about the newly introduced magic numbers. I wish it could be quickly resolved in next patch

youknowone merged commit 3a6fda4 into RustPython : main Oct 5, 2025

ShaharNaveh commented Oct 5, 2025



Copy link Copy Markdown
Contributor

Author

I am worrying about the newly introduced magic numbers. I wish it could be quickly resolved in next patch

I'll send a quick patch to resolve it in the next couple of days

youknowone mentioned this pull request Dec 4, 2025 Update Python libraries and tests from Python 3.13 #5529 Closed Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

2 participants