Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit665a439

Browse files
authored
gh-105481: generate op IDs from bytecode.c instead of hard coding them in opcode.py (#107971)
1 parente88eb37 commit665a439

File tree

21 files changed

+1533
-1461
lines changed

21 files changed

+1533
-1461
lines changed

‎Include/internal/pycore_opcode.h‎

Lines changed: 0 additions & 540 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Include/internal/pycore_opcode_metadata.h‎

Lines changed: 490 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Include/opcode_ids.h‎

Lines changed: 219 additions & 217 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Lib/_opcode_metadata.py‎

Lines changed: 225 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Lib/dis.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
_intrinsic_1_descs,
1515
_intrinsic_2_descs,
1616
_specializations,
17-
_specialized_instructions,
17+
_specialized_opmap,
1818
)
1919

2020
__all__= ["code_info","dis","disassemble","distb","disco",
@@ -49,11 +49,11 @@
4949

5050
_all_opname=list(opname)
5151
_all_opmap=dict(opmap)
52-
_empty_slot= [slotforslot,nameinenumerate(_all_opname)ifname.startswith("<")]
53-
forspec_op,specializedinzip(_empty_slot,_specialized_instructions):
52+
forname,opin_specialized_opmap.items():
5453
# fill opname and opmap
55-
_all_opname[spec_op]=specialized
56-
_all_opmap[specialized]=spec_op
54+
assertop<len(_all_opname)
55+
_all_opname[op]=name
56+
_all_opmap[name]=op
5757

5858
deoptmap= {
5959
specialized:baseforbase,familyin_specializations.items()forspecializedinfamily

‎Lib/importlib/_bootstrap_external.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ def _write_atomic(path, data, mode=0o666):
454454
# Python 3.13a1 3556 (Convert LOAD_CLOSURE to a pseudo-op)
455455
# Python 3.13a1 3557 (Make the conversion to boolean in jumps explicit)
456456
# Python 3.13a1 3558 (Reorder the stack items for CALL)
457+
# Python 3.13a1 3559 (Generate opcode IDs from bytecodes.c)
457458

458459
# Python 3.14 will start with 3600
459460

@@ -470,7 +471,7 @@ def _write_atomic(path, data, mode=0o666):
470471
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
471472
# in PC/launcher.c must also be updated.
472473

473-
MAGIC_NUMBER= (3558).to_bytes(2,'little')+b'\r\n'
474+
MAGIC_NUMBER= (3559).to_bytes(2,'little')+b'\r\n'
474475

475476
_RAW_MAGIC_NUMBER=int.from_bytes(MAGIC_NUMBER,'little')# For import.c
476477

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp