mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-61853: PY-41642 Don't rely on Python version when importing _unpack_args, try and catch error instead
The `_unpack_args` function doesn't seem to be available in early versions of Python 3. So it's better not to rely on the Python version check and just try importing the function and execute the fallback code inside the except clause. (cherry picked from commit 0b5125e3c00602372528ae545e9d5677939619ee) GitOrigin-RevId: 294d436d661baf8f8329fb1e2cff755391a49a50
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e23b287ef8
commit
10a42be9c3
@@ -102,9 +102,11 @@ def _is_make_opname(opname):
|
||||
Instruction = namedtuple("Instruction", ["opname", "opcode", "arg", "argval", "lineno", "offset"])
|
||||
|
||||
if IS_PY3K:
|
||||
_unpack_opargs = dis._unpack_opargs
|
||||
long = int
|
||||
else:
|
||||
|
||||
try:
|
||||
_unpack_opargs = dis._unpack_opargs
|
||||
except AttributeError:
|
||||
def _unpack_opargs(code):
|
||||
n = len(code)
|
||||
i = 0
|
||||
|
||||
Reference in New Issue
Block a user