MCPcopy Index your code
hub / github.com/RustPython/RustPython / _get_const_value

Function _get_const_value

Lib/dis.py:682–696  ·  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

680 arg_resolver=arg_resolver)
681
682def _get_const_value(op, arg, co_consts):
683 """Helper to get the value of the const in a hasconst op.
684
685 Returns the dereferenced constant if this is possible.
686 Otherwise (if it is a LOAD_CONST and co_consts is not
687 provided) returns the dis.UNKNOWN sentinel.
688 """
689 assert op in hasconst or op == LOAD_SMALL_INT
690
691 if op == LOAD_SMALL_INT:
692 return arg
693 argval = UNKNOWN
694 if co_consts is not None:
695 argval = co_consts[arg]
696 return argval
697
698def _get_const_info(op, arg, co_consts):
699 """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