MCPcopy Index your code
hub / github.com/python/cpython / _get_const_value

Function _get_const_value

Lib/dis.py:688–702  ·  view source on GitHub ↗

Helper to get the value of the const in a hasconst op. Returns the dereferenced constant if this is possible. Otherwise (if it is a LOAD_CONST and co_consts is not provided) returns the dis.UNKNOWN sentinel.

(op, arg, co_consts)

Source from the content-addressed store, hash-verified

686 arg_resolver=arg_resolver)
687
688def _get_const_value(op, arg, co_consts):
689 """Helper to get the value of the const in a hasconst op.
690
691 Returns the dereferenced constant if this is possible.
692 Otherwise (if it is a LOAD_CONST and co_consts is not
693 provided) returns the dis.UNKNOWN sentinel.
694 """
695 assert op in hasconst or op == LOAD_SMALL_INT
696
697 if op == LOAD_SMALL_INT:
698 return arg
699 argval = UNKNOWN
700 if co_consts is not None:
701 argval = co_consts[arg]
702 return argval
703
704def _get_const_info(op, arg, co_consts):
705 """Helper to get optional details about const references

Callers 2

_get_const_infoFunction · 0.85
_find_importsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…