Skip to content

Commit 647df71

Browse files
authored
Merge pull request #416 from jameshilliard/fix-parsers-version
Fix ImportError: cannot import name PYTHON_VERSION
2 parents 8843686 + ab508e1 commit 647df71

File tree

9 files changed

+27
-27
lines changed

9 files changed

+27
-27
lines changed

uncompyle6/parsers/parse26.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,13 @@ class Python26ParserSingle(Python2Parser, PythonParserSingle):
546546
# Check grammar
547547
p = Python26Parser()
548548
p.check_grammar()
549-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
549+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
550550

551-
if PYTHON_VERSION == 2.6:
551+
if PYTHON_VERSION_TRIPLE[:2] == (2, 6):
552552
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
553553
from uncompyle6.scanner import get_scanner
554554

555-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
555+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
556556
opcode_set = set(s.opc.opname).union(
557557
set(
558558
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM

uncompyle6/parsers/parse27.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ class Python27ParserSingle(Python27Parser, PythonParserSingle):
375375
# Check grammar
376376
p = Python27Parser()
377377
p.check_grammar()
378-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
379-
if PYTHON_VERSION == 2.7:
378+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
379+
if PYTHON_VERSION_TRIPLE[:2] == (2, 7):
380380
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
381381
from uncompyle6.scanner import get_scanner
382-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
382+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
383383
opcode_set = set(s.opc.opname).union(set(
384384
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
385385
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP

uncompyle6/parsers/parse30.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,11 @@ class Python30ParserSingle(Python30Parser, PythonParserSingle):
365365
p = Python30Parser()
366366
p.remove_rules_30()
367367
p.check_grammar()
368-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
369-
if PYTHON_VERSION == 3.0:
368+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
369+
if PYTHON_VERSION_TRIPLE[:2] == (3, 0):
370370
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
371371
from uncompyle6.scanner import get_scanner
372-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
372+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
373373
opcode_set = set(s.opc.opname).union(set(
374374
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
375375
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME

uncompyle6/parsers/parse31.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class Python31ParserSingle(Python31Parser, PythonParserSingle):
5656
p = Python31Parser()
5757
p.remove_rules_31()
5858
p.check_grammar()
59-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
60-
if PYTHON_VERSION == 3.1:
59+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
60+
if PYTHON_VERSION_TRIPLE[:2] == (3, 1):
6161
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
6262
from uncompyle6.scanner import get_scanner
63-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
63+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
6464
opcode_set = set(s.opc.opname).union(set(
6565
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
6666
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME

uncompyle6/parsers/parse34.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ class Python34ParserSingle(Python34Parser, PythonParserSingle):
7070
# Check grammar
7171
p = Python34Parser()
7272
p.check_grammar()
73-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
74-
if PYTHON_VERSION == 3.4:
73+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
74+
if PYTHON_VERSION_TRIPLE[:2] == (3, 4):
7575
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
7676
from uncompyle6.scanner import get_scanner
77-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
77+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
7878
opcode_set = set(s.opc.opname).union(set(
7979
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
8080
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME

uncompyle6/parsers/parse35.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,11 @@ class Python35ParserSingle(Python35Parser, PythonParserSingle):
273273
# Check grammar
274274
p = Python35Parser()
275275
p.check_grammar()
276-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
277-
if PYTHON_VERSION == 3.5:
276+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
277+
if PYTHON_VERSION_TRIPLE[:2] == (3, 5):
278278
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
279279
from uncompyle6.scanner import get_scanner
280-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
280+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
281281
opcode_set = set(s.opc.opname).union(set(
282282
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
283283
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME

uncompyle6/parsers/parse36.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,11 +673,11 @@ class Python36ParserSingle(Python36Parser, PythonParserSingle):
673673
# Check grammar
674674
p = Python36Parser()
675675
p.check_grammar()
676-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
677-
if PYTHON_VERSION == 3.6:
676+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
677+
if PYTHON_VERSION_TRIPLE[:2] == (3, 6):
678678
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
679679
from uncompyle6.scanner import get_scanner
680-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
680+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
681681
opcode_set = set(s.opc.opname).union(set(
682682
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
683683
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME

uncompyle6/parsers/parse37.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,13 +1740,13 @@ class Python37ParserSingle(Python37Parser, PythonParserSingle):
17401740
# FIXME: DRY this with other parseXX.py routines
17411741
p = Python37Parser()
17421742
p.check_grammar()
1743-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
1743+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
17441744

1745-
if PYTHON_VERSION == 3.7:
1745+
if PYTHON_VERSION_TRIPLE[:2] == (3, 7):
17461746
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
17471747
from uncompyle6.scanner import get_scanner
17481748

1749-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
1749+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
17501750
opcode_set = set(s.opc.opname).union(
17511751
set(
17521752
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM

uncompyle6/parsers/parse38.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,13 +610,13 @@ class Python38ParserSingle(Python38Parser, PythonParserSingle):
610610
p = Python38Parser()
611611
p.remove_rules_38()
612612
p.check_grammar()
613-
from uncompyle6 import PYTHON_VERSION, IS_PYPY
613+
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
614614

615-
if PYTHON_VERSION == 3.8:
615+
if PYTHON_VERSION_TRIPLE[:2] == (3, 8):
616616
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
617617
from uncompyle6.scanner import get_scanner
618618

619-
s = get_scanner(PYTHON_VERSION, IS_PYPY)
619+
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
620620
opcode_set = set(s.opc.opname).union(
621621
set(
622622
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM

0 commit comments

Comments
 (0)