MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _unpack_opargs

Function _unpack_opargs

tools/python-3.11.9-amd64/Lib/dis.py:594–616  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

592_INT_OVERFLOW = 2 ** (_INT_BITS - 1)
593
594def _unpack_opargs(code):
595 extended_arg = 0
596 caches = 0
597 for i in range(0, len(code), 2):
598 # Skip inline CACHE entries:
599 if caches:
600 caches -= 1
601 continue
602 op = code[i]
603 deop = _deoptop(op)
604 caches = _inline_cache_entries[deop]
605 if deop >= HAVE_ARGUMENT:
606 arg = code[i+1] | extended_arg
607 extended_arg = (arg << 8) if deop == EXTENDED_ARG else 0
608 # The oparg is stored as a signed integer
609 # If the value exceeds its upper limit, it will overflow and wrap
610 # to a negative integer
611 if extended_arg >= _INT_OVERFLOW:
612 extended_arg -= 2 * _INT_OVERFLOW
613 else:
614 arg = None
615 extended_arg = 0
616 yield (i, op, arg)
617
618def findlabels(code):
619 """Detect all offsets in a byte code which are jump targets.

Callers 4

_get_instructions_bytesFunction · 0.85
findlabelsFunction · 0.85
_find_importsFunction · 0.85
_find_store_namesFunction · 0.85

Calls 1

_deoptopFunction · 0.85

Tested by

no test coverage detected