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)
| 352 | show_caches=show_caches) |
| 353 | |
| 354 | def _get_const_value(op, arg, co_consts): |
| 355 | """Helper to get the value of the const in a hasconst op. |
| 356 | |
| 357 | Returns the dereferenced constant if this is possible. |
| 358 | Otherwise (if it is a LOAD_CONST and co_consts is not |
| 359 | provided) returns the dis.UNKNOWN sentinel. |
| 360 | """ |
| 361 | assert op in hasconst |
| 362 | |
| 363 | argval = UNKNOWN |
| 364 | if op == LOAD_CONST: |
| 365 | if co_consts is not None: |
| 366 | argval = co_consts[arg] |
| 367 | return argval |
| 368 | |
| 369 | def _get_const_info(op, arg, co_consts): |
| 370 | """Helper to get optional details about const references |
no outgoing calls
no test coverage detected