@@ -643,6 +643,7 @@ def get_argval_argrepr(self, op, arg, offset):
643643 argrepr = _intrinsic_2_descs [arg ]
644644 elif deop == LOAD_COMMON_CONSTANT :
645645 obj = _common_constants [arg ]
646+ argval = obj
646647 if isinstance (obj , type ):
647648 argrepr = obj .__name__
648649 else :
@@ -692,10 +693,15 @@ def _get_const_value(op, arg, co_consts):
692693 Otherwise (if it is a LOAD_CONST and co_consts is not
693694 provided) returns the dis.UNKNOWN sentinel.
694695 """
695- assert op in hasconst or op == LOAD_SMALL_INT
696+ assert op in hasconst or op == LOAD_SMALL_INT or op == LOAD_COMMON_CONSTANT
696697
697698 if op == LOAD_SMALL_INT :
698699 return arg
700+ if op == LOAD_COMMON_CONSTANT :
701+ # Opargs 0-6 are callables; 7-11 are literal values.
702+ if 7 <= arg <= 11 :
703+ return _common_constants [arg ]
704+ return UNKNOWN
699705 argval = UNKNOWN
700706 if co_consts is not None :
701707 argval = co_consts [arg ]
@@ -1015,8 +1021,9 @@ def _find_imports(co):
10151021 if op == IMPORT_NAME and i >= 2 :
10161022 from_op = opargs [i - 1 ]
10171023 level_op = opargs [i - 2 ]
1018- if (from_op [0 ] in hasconst and
1019- (level_op [0 ] in hasconst or level_op [0 ] == LOAD_SMALL_INT )):
1024+ if ((from_op [0 ] in hasconst or from_op [0 ] == LOAD_COMMON_CONSTANT ) and
1025+ (level_op [0 ] in hasconst or level_op [0 ] == LOAD_SMALL_INT or
1026+ level_op [0 ] == LOAD_COMMON_CONSTANT )):
10201027 level = _get_const_value (level_op [0 ], level_op [1 ], consts )
10211028 fromlist = _get_const_value (from_op [0 ], from_op [1 ], consts )
10221029 # IMPORT_NAME encodes lazy/eager flags in bits 0-1,
0 commit comments