Skip to content

Commit f9e7a4a

Browse files
author
rocky
committed
Small tweaks
1 parent c90cb45 commit f9e7a4a

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

xdis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2015-2017, 2020-2024 by Rocky Bernstein
2+
Copyright (c) 2015-2017, 2020-2025 by Rocky Bernstein
33
Copyright (c) 2000 by hartmut Goebel <[email protected]>
44
55
This program is free software; you can redistribute it and/or

xdis/opcodes/base.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -478,30 +478,31 @@ def update_sets(loc, is_pypy: bool, is_rust=False) -> None:
478478
loc["JABS_OPS"] = frozenset(loc["hasjabs"])
479479

480480
python_version = loc.get("python_version")
481-
if python_version and python_version < (3, 11) or (is_pypy and python_version == (3, 11)):
481+
if python_version:
482482
loc["JUMP_UNCONDITIONAL"] = frozenset(
483-
[loc["opmap"]["JUMP_ABSOLUTE"], loc["opmap"]["JUMP_FORWARD"]]
483+
[
484+
loc["opmap"][op]
485+
for op in {
486+
"JUMP_ABSOLUTE",
487+
"JUMP_FORWARD",
488+
"JUMP_BACKWARD",
489+
"JUMP_BACKWARD_NO_INTERRUPT",
490+
}
491+
if op in loc["opmap"]
492+
]
484493
)
485-
elif python_version:
486-
if not is_pypy and not is_rust:
487-
loc["JUMP_UNCONDITIONAL"] = frozenset(
488-
[
489-
loc["opmap"]["JUMP_FORWARD"],
490-
loc["opmap"]["JUMP_BACKWARD"],
491-
loc["opmap"]["JUMP_BACKWARD_NO_INTERRUPT"],
492-
]
493-
)
494-
else:
495-
loc["JUMP_UNCONDITIONAL"] = frozenset([loc["opmap"]["JUMP_FORWARD"]])
496494
if PYTHON_VERSION_TRIPLE < (3, 8, 0) and python_version and python_version < (3, 8):
497495
loc["LOOP_OPS"] = frozenset([loc["opmap"]["SETUP_LOOP"]])
498496
else:
499497
loc["LOOP_OPS"] = frozenset()
500498

501499
loc["LOCAL_OPS"] = frozenset(loc["haslocal"])
502-
if not is_rust:
500+
if not is_rust and python_version:
503501
loc["JUMP_OPS"] = (
504-
loc["JABS_OPS"] | loc["JREL_OPS"] | loc["LOOP_OPS"] | loc["JUMP_UNCONDITIONAL"]
502+
loc["JABS_OPS"]
503+
| loc["JREL_OPS"]
504+
| loc["LOOP_OPS"]
505+
| loc["JUMP_UNCONDITIONAL"]
505506
)
506507
loc["NAME_OPS"] = frozenset(loc["hasname"])
507508
loc["NARGS_OPS"] = frozenset(loc["hasnargs"])

0 commit comments

Comments
 (0)