summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-03-17 16:14:57 (GMT)
committerGitHub <noreply@github.com>2022-03-17 16:14:57 (GMT)
commit3011a097bd9500c007bd8b8d005edeea895f6b44 (patch)
treed2637ab682e1265eaf23316add1039b3829abb19 /Lib/dis.py
parentef1327e3b622e0cafdf8bfc1f480fed0dd386be6 (diff)
downloadcpython-3011a097bd9500c007bd8b8d005edeea895f6b44.zip
cpython-3011a097bd9500c007bd8b8d005edeea895f6b44.tar.gz
cpython-3011a097bd9500c007bd8b8d005edeea895f6b44.tar.bz2
Use low bit of LOAD_GLOBAL's oparg to indicate whether it should push an additional NULL. (GH-31933)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index 2598d4a..3b7747b 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -28,6 +28,7 @@ MAKE_FUNCTION = opmap['MAKE_FUNCTION']
MAKE_FUNCTION_FLAGS = ('defaults', 'kwdefaults', 'annotations', 'closure')
LOAD_CONST = opmap['LOAD_CONST']
+LOAD_GLOBAL = opmap['LOAD_GLOBAL']
BINARY_OP = opmap['BINARY_OP']
CACHE = opmap["CACHE"]
@@ -430,7 +431,12 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
if op in hasconst:
argval, argrepr = _get_const_info(op, arg, co_consts)
elif op in hasname:
- argval, argrepr = _get_name_info(arg, get_name)
+ if op == LOAD_GLOBAL:
+ argval, argrepr = _get_name_info(arg//2, get_name)
+ if (arg & 1) and argrepr:
+ argrepr = "NULL + " + argrepr
+ else:
+ argval, argrepr = _get_name_info(arg, get_name)
elif op in hasjabs:
argval = arg*2
argrepr = "to " + repr(argval)