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)
| 680 | arg_resolver=arg_resolver) |
| 681 | |
| 682 | def _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 | |
| 698 | def _get_const_info(op, arg, co_consts): |
| 699 | """Helper to get optional details about const references |
no outgoing calls
no test coverage detected