mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-02-21 13:42:56 +00:00
Use tuples not floats in Python release comparison
This commit is contained in:
parent
15efaffe8d
commit
8ac7a75372
@ -642,7 +642,7 @@ def get_python_parser(
|
||||
|
||||
# If version is a string, turn that into the corresponding float.
|
||||
if isinstance(version, str):
|
||||
version = tuple([int(v) for v in version.split(".")[:3]])
|
||||
version = tuple([int(v) for v in version.split(".")[:2]])
|
||||
|
||||
# FIXME: there has to be a better way...
|
||||
# We could do this as a table lookup, but that would force us
|
||||
@ -651,98 +651,98 @@ def get_python_parser(
|
||||
|
||||
if version < (3, 0):
|
||||
if version < (2, 2):
|
||||
if version[:2] == (1, 0):
|
||||
if version == (1, 0):
|
||||
import uncompyle6.parsers.parse10 as parse10
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse10.Python10Parser(debug_parser)
|
||||
else:
|
||||
p = parse10.Python01ParserSingle(debug_parser)
|
||||
elif version[:2] == (1, 1):
|
||||
elif version == (1, 1):
|
||||
import uncompyle6.parsers.parse11 as parse11
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse11.Python11Parser(debug_parser)
|
||||
else:
|
||||
p = parse11.Python11ParserSingle(debug_parser)
|
||||
if version[:2] == (1, 2):
|
||||
if version == (1, 2):
|
||||
import uncompyle6.parsers.parse12 as parse12
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse12.Python12Parser(debug_parser)
|
||||
else:
|
||||
p = parse12.Python12ParserSingle(debug_parser)
|
||||
if version[:2] == (1, 3):
|
||||
if version == (1, 3):
|
||||
import uncompyle6.parsers.parse13 as parse13
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse13.Python13Parser(debug_parser)
|
||||
else:
|
||||
p = parse13.Python13ParserSingle(debug_parser)
|
||||
elif version == 1.4:
|
||||
elif version == (1, 4):
|
||||
import uncompyle6.parsers.parse14 as parse14
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse14.Python14Parser(debug_parser)
|
||||
else:
|
||||
p = parse14.Python14ParserSingle(debug_parser)
|
||||
elif version == 1.5:
|
||||
elif version == (1, 5):
|
||||
import uncompyle6.parsers.parse15 as parse15
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse15.Python15Parser(debug_parser)
|
||||
else:
|
||||
p = parse15.Python15ParserSingle(debug_parser)
|
||||
elif version == 1.6:
|
||||
elif version == (1, 6):
|
||||
import uncompyle6.parsers.parse16 as parse16
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse16.Python16Parser(debug_parser)
|
||||
else:
|
||||
p = parse16.Python16ParserSingle(debug_parser)
|
||||
elif version == 2.1:
|
||||
elif version == (2, 1):
|
||||
import uncompyle6.parsers.parse21 as parse21
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse21.Python21Parser(debug_parser)
|
||||
else:
|
||||
p = parse21.Python21ParserSingle(debug_parser)
|
||||
elif version == 2.2:
|
||||
elif version == (2, 2):
|
||||
import uncompyle6.parsers.parse22 as parse22
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse22.Python22Parser(debug_parser)
|
||||
else:
|
||||
p = parse22.Python22ParserSingle(debug_parser)
|
||||
elif version == 2.3:
|
||||
elif version == (2, 3):
|
||||
import uncompyle6.parsers.parse23 as parse23
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse23.Python23Parser(debug_parser)
|
||||
else:
|
||||
p = parse23.Python23ParserSingle(debug_parser)
|
||||
elif version == 2.4:
|
||||
elif version == (2, 4):
|
||||
import uncompyle6.parsers.parse24 as parse24
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse24.Python24Parser(debug_parser)
|
||||
else:
|
||||
p = parse24.Python24ParserSingle(debug_parser)
|
||||
elif version == 2.5:
|
||||
elif version == (2, 5):
|
||||
import uncompyle6.parsers.parse25 as parse25
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse25.Python25Parser(debug_parser)
|
||||
else:
|
||||
p = parse25.Python25ParserSingle(debug_parser)
|
||||
elif version == 2.6:
|
||||
elif version == (2, 6):
|
||||
import uncompyle6.parsers.parse26 as parse26
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse26.Python26Parser(debug_parser)
|
||||
else:
|
||||
p = parse26.Python26ParserSingle(debug_parser)
|
||||
elif version == 2.7:
|
||||
elif version == (2, 7):
|
||||
import uncompyle6.parsers.parse27 as parse27
|
||||
|
||||
if compile_mode == "exec":
|
||||
@ -762,63 +762,63 @@ def get_python_parser(
|
||||
else:
|
||||
import uncompyle6.parsers.parse3 as parse3
|
||||
|
||||
if version == 3.0:
|
||||
if version == (3, 0):
|
||||
import uncompyle6.parsers.parse30 as parse30
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse30.Python30Parser(debug_parser)
|
||||
else:
|
||||
p = parse30.Python30ParserSingle(debug_parser)
|
||||
elif version == 3.1:
|
||||
elif version == (3, 1):
|
||||
import uncompyle6.parsers.parse31 as parse31
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse31.Python31Parser(debug_parser)
|
||||
else:
|
||||
p = parse31.Python31ParserSingle(debug_parser)
|
||||
elif version == 3.2:
|
||||
elif version == (3, 2):
|
||||
import uncompyle6.parsers.parse32 as parse32
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse32.Python32Parser(debug_parser)
|
||||
else:
|
||||
p = parse32.Python32ParserSingle(debug_parser)
|
||||
elif version == 3.3:
|
||||
elif version == (3, 3):
|
||||
import uncompyle6.parsers.parse33 as parse33
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse33.Python33Parser(debug_parser)
|
||||
else:
|
||||
p = parse33.Python33ParserSingle(debug_parser)
|
||||
elif version == 3.4:
|
||||
elif version == (3, 4):
|
||||
import uncompyle6.parsers.parse34 as parse34
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse34.Python34Parser(debug_parser)
|
||||
else:
|
||||
p = parse34.Python34ParserSingle(debug_parser)
|
||||
elif version == 3.5:
|
||||
elif version == (3, 5):
|
||||
import uncompyle6.parsers.parse35 as parse35
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse35.Python35Parser(debug_parser)
|
||||
else:
|
||||
p = parse35.Python35ParserSingle(debug_parser)
|
||||
elif version == 3.6:
|
||||
elif version == (3, 6):
|
||||
import uncompyle6.parsers.parse36 as parse36
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse36.Python36Parser(debug_parser)
|
||||
else:
|
||||
p = parse36.Python36ParserSingle(debug_parser)
|
||||
elif version == 3.7:
|
||||
elif version == (3, 7):
|
||||
import uncompyle6.parsers.parse37 as parse37
|
||||
|
||||
if compile_mode == "exec":
|
||||
p = parse37.Python37Parser(debug_parser)
|
||||
else:
|
||||
p = parse37.Python37ParserSingle(debug_parser)
|
||||
elif version == 3.8:
|
||||
elif version == (3, 8):
|
||||
import uncompyle6.parsers.parse38 as parse38
|
||||
|
||||
if compile_mode == "exec":
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2017 by Rocky Bernstein
|
||||
# Copyright (c) 2016-2017, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python PyPy 2.7 bytecode scanner/deparser
|
||||
|
||||
@ -22,5 +22,5 @@ class ScannerPyPy27(scan.Scanner27):
|
||||
# There are no differences in initialization between
|
||||
# pypy 2.7 and 2.7
|
||||
scan.Scanner27.__init__(self, show_asm, is_pypy=True)
|
||||
self.version = 2.7
|
||||
self.version = (2, 7)
|
||||
return
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017 by Rocky Bernstein
|
||||
# Copyright (c) 2017, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python PyPy 3.2 decompiler scanner.
|
||||
|
||||
@ -18,6 +18,6 @@ class ScannerPyPy32(scan.Scanner32):
|
||||
# There are no differences in initialization between
|
||||
# pypy 3.2 and 3.2
|
||||
scan.Scanner32.__init__(self, show_asm, is_pypy=True)
|
||||
self.version = 3.2
|
||||
self.version = (3, 2)
|
||||
self.opc = opc
|
||||
return
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019-2020 by Rocky Bernstein
|
||||
# Copyright (c) 2019-2021 by Rocky Bernstein
|
||||
"""
|
||||
Python PyPy 3.3 decompiler scanner.
|
||||
|
||||
@ -19,6 +19,6 @@ class ScannerPyPy33(scan.Scanner33):
|
||||
# There are no differences in initialization between
|
||||
# pypy 3.3 and 3.3
|
||||
scan.Scanner33.__init__(self, show_asm, is_pypy=True)
|
||||
self.version = 3.3
|
||||
self.version = (3, 3)
|
||||
self.opc = opc
|
||||
return
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017, 2019 by Rocky Bernstein
|
||||
# Copyright (c) 2017, 2019, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python PyPy 3.5 decompiler scanner.
|
||||
|
||||
@ -18,5 +18,5 @@ class ScannerPyPy35(scan.Scanner35):
|
||||
# There are no differences in initialization between
|
||||
# pypy 3.5 and 3.5
|
||||
scan.Scanner35.__init__(self, show_asm, is_pypy=True)
|
||||
self.version = 3.5
|
||||
self.version = (3, 5)
|
||||
return
|
||||
|
@ -18,5 +18,5 @@ class ScannerPyPy36(scan.Scanner36):
|
||||
# There are no differences in initialization between
|
||||
# pypy 3.6 and 3.6
|
||||
scan.Scanner36.__init__(self, show_asm, is_pypy=True)
|
||||
self.version = 3.6
|
||||
self.version = (3, 6)
|
||||
return
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019 by Rocky Bernstein
|
||||
# Copyright (c) 2019, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 1.0 bytecode decompiler massaging.
|
||||
|
||||
@ -22,7 +22,7 @@ class Scanner10(scan.Scanner11):
|
||||
scan.Scanner11.__init__(self, show_asm)
|
||||
self.opc = opcode_10
|
||||
self.opname = opcode_10.opname
|
||||
self.version = 1.0
|
||||
self.version = (1, 0)
|
||||
return
|
||||
|
||||
# def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019 by Rocky Bernstein
|
||||
# Copyright (c) 2019, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 1.1 bytecode decompiler massaging.
|
||||
|
||||
@ -22,7 +22,7 @@ class Scanner11(scan.Scanner13): # no scanner 1.2
|
||||
scan.Scanner13.__init__(self, show_asm)
|
||||
self.opc = opcode_11
|
||||
self.opname = opcode_11.opname
|
||||
self.version = 1.1
|
||||
self.version = (1, 1)
|
||||
return
|
||||
|
||||
# def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019 by Rocky Bernstein
|
||||
# Copyright (c) 2019, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 1.2 bytecode decompiler massaging.
|
||||
|
||||
@ -23,7 +23,7 @@ class Scanner12(scan.Scanner13):
|
||||
scan.Scanner14.__init__(self, show_asm)
|
||||
self.opc = opcode_11
|
||||
self.opname = opcode_11.opname
|
||||
self.version = 1.2 # Note: is the same as 1.1 bytecode
|
||||
self.version = (1, 2) # Note: is the same as 1.1 bytecode
|
||||
return
|
||||
|
||||
# def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2018-2019 by Rocky Bernstein
|
||||
# Copyright (c) 2018-2019, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 1.3 bytecode decompiler massaging.
|
||||
|
||||
@ -24,7 +24,7 @@ class Scanner13(scan.Scanner14):
|
||||
scan.Scanner14.__init__(self, show_asm)
|
||||
self.opc = opcode_13
|
||||
self.opname = opcode_13.opname
|
||||
self.version = 1.3
|
||||
self.version = (1, 3)
|
||||
return
|
||||
|
||||
# def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2018-2019 by Rocky Bernstein
|
||||
# Copyright (c) 2018-2019, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 1.4 bytecode decompiler massaging.
|
||||
|
||||
@ -22,7 +22,7 @@ class Scanner14(scan.Scanner15):
|
||||
scan.Scanner15.__init__(self, show_asm)
|
||||
self.opc = opcode_14
|
||||
self.opname = opcode_14.opname
|
||||
self.version = 1.4
|
||||
self.version = (1, 4)
|
||||
self.genexpr_name = '<generator expression>'
|
||||
return
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2018 by Rocky Bernstein
|
||||
# Copyright (c) 2016-2018, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 1.5 bytecode decompiler massaging.
|
||||
|
||||
@ -22,7 +22,7 @@ class Scanner15(scan.Scanner21):
|
||||
scan.Scanner21.__init__(self, show_asm)
|
||||
self.opc = opcode_15
|
||||
self.opname = opcode_15.opname
|
||||
self.version = 1.5
|
||||
self.version = (1, 5)
|
||||
self.genexpr_name = '<generator expression>'
|
||||
return
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019 by Rocky Bernstein
|
||||
# Copyright (c) 2019, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 1.6 bytecode decompiler massaging.
|
||||
|
||||
@ -22,7 +22,7 @@ class Scanner16(scan.Scanner21):
|
||||
scan.Scanner21.__init__(self, show_asm)
|
||||
self.opc = opcode_16
|
||||
self.opname = opcode_16.opname
|
||||
self.version = 1.6
|
||||
self.version = (1, 6)
|
||||
self.genexpr_name = '<generator expression>'
|
||||
return
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2018 by Rocky Bernstein
|
||||
# Copyright (c) 2016-2018, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 2.1 bytecode massaging.
|
||||
|
||||
@ -22,6 +22,6 @@ class Scanner21(scan.Scanner22):
|
||||
scan.Scanner22.__init__(self, show_asm)
|
||||
self.opc = opcode_21
|
||||
self.opname = opcode_21.opname
|
||||
self.version = 2.1
|
||||
self.version = (2, 1)
|
||||
self.genexpr_name = '<generator expression>'
|
||||
return
|
||||
|
@ -22,7 +22,7 @@ class Scanner22(scan.Scanner23):
|
||||
scan.Scanner23.__init__(self, show_asm)
|
||||
self.opc = opcode_22
|
||||
self.opname = opcode_22.opname
|
||||
self.version = 2.2
|
||||
self.version = (2, 2)
|
||||
self.genexpr_name = '<generator expression>'
|
||||
self.parent_ingest = self.ingest
|
||||
self.ingest = self.ingest22
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015-2018 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2018, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 2.5 bytecode massaging.
|
||||
|
||||
@ -24,5 +24,5 @@ class Scanner25(scan.Scanner26):
|
||||
self.opc = opcode_25
|
||||
self.opname = opcode_25.opname
|
||||
scan.Scanner26.__init__(self, show_asm)
|
||||
self.version = 2.5
|
||||
self.version = (2, 5)
|
||||
return
|
||||
|
@ -213,13 +213,13 @@ class Scanner26(scan.Scanner2):
|
||||
# CE - Hack for >= 2.5
|
||||
# Now all values loaded via LOAD_CLOSURE are packed into
|
||||
# a tuple before calling MAKE_CLOSURE.
|
||||
if (self.version >= 2.5 and op == self.opc.BUILD_TUPLE and
|
||||
if (self.version >= (2, 5) and op == self.opc.BUILD_TUPLE and
|
||||
self.code[self.prev[offset]] == self.opc.LOAD_CLOSURE):
|
||||
continue
|
||||
else:
|
||||
op_name = '%s_%d' % (op_name, oparg)
|
||||
customize[op_name] = oparg
|
||||
elif self.version > 2.0 and op == self.opc.CONTINUE_LOOP:
|
||||
elif self.version > (2, 0) and op == self.opc.CONTINUE_LOOP:
|
||||
customize[op_name] = 0
|
||||
elif op_name in """
|
||||
CONTINUE_LOOP EXEC_STMT LOAD_LISTCOMP LOAD_SETCOMP
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2017, 2020 by Rocky Bernstein
|
||||
# Copyright (c) 2016-2017, 2020-2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 3.0 bytecode scanner/deparser
|
||||
|
||||
@ -20,7 +20,7 @@ from uncompyle6.scanners.scanner3 import Scanner3
|
||||
|
||||
class Scanner30(Scanner3):
|
||||
def __init__(self, show_asm=None, is_pypy=False):
|
||||
Scanner3.__init__(self, 3.0, show_asm, is_pypy)
|
||||
Scanner3.__init__(self, (3, 0), show_asm, is_pypy)
|
||||
return
|
||||
|
||||
pass
|
||||
@ -473,7 +473,7 @@ class Scanner30(Scanner3):
|
||||
if __name__ == "__main__":
|
||||
from uncompyle6 import PYTHON_VERSION
|
||||
|
||||
if PYTHON_VERSION == 3.0:
|
||||
if PYTHON_VERSION == (3, 0):
|
||||
import inspect
|
||||
|
||||
co = inspect.currentframe().f_code
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2017 by Rocky Bernstein
|
||||
# Copyright (c) 2016-2017, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 3.1 bytecode scanner/deparser
|
||||
|
||||
@ -16,13 +16,13 @@ from uncompyle6.scanners.scanner3 import Scanner3
|
||||
class Scanner31(Scanner3):
|
||||
|
||||
def __init__(self, show_asm=None, is_pypy=False):
|
||||
Scanner3.__init__(self, 3.1, show_asm, is_pypy)
|
||||
Scanner3.__init__(self, (3, 1), show_asm, is_pypy)
|
||||
return
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
from uncompyle6 import PYTHON_VERSION
|
||||
if PYTHON_VERSION == 3.1:
|
||||
if PYTHON_VERSION == (3, 1):
|
||||
import inspect
|
||||
co = inspect.currentframe().f_code
|
||||
tokens, customize = Scanner31().ingest(co)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015-2017 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2017, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 3.2 bytecode decompiler scanner.
|
||||
|
||||
@ -19,7 +19,7 @@ from uncompyle6.scanners.scanner3 import Scanner3
|
||||
class Scanner32(Scanner3):
|
||||
|
||||
def __init__(self, show_asm=None, is_pypy=False):
|
||||
Scanner3.__init__(self, 3.2, show_asm, is_pypy)
|
||||
Scanner3.__init__(self, (3, 2), show_asm, is_pypy)
|
||||
return
|
||||
pass
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015-2019 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2019, 2021 by Rocky Bernstein
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -29,7 +29,7 @@ from uncompyle6.scanners.scanner3 import Scanner3
|
||||
class Scanner33(Scanner3):
|
||||
|
||||
def __init__(self, show_asm=False, is_pypy=False):
|
||||
Scanner3.__init__(self, 3.3, show_asm)
|
||||
Scanner3.__init__(self, (3, 3), show_asm)
|
||||
return
|
||||
pass
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017 by Rocky Bernstein
|
||||
# Copyright (c) 2017, 2021 by Rocky Bernstein
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -33,7 +33,7 @@ JUMP_OPS = opc.JUMP_OPS
|
||||
class Scanner35(Scanner3):
|
||||
|
||||
def __init__(self, show_asm=None, is_pypy=False):
|
||||
Scanner3.__init__(self, 3.5, show_asm, is_pypy)
|
||||
Scanner3.__init__(self, (3, 5), show_asm, is_pypy)
|
||||
return
|
||||
pass
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2018 by Rocky Bernstein
|
||||
# Copyright (c) 2016-2018, 2021 by Rocky Bernstein
|
||||
"""
|
||||
Python 3.6 bytecode decompiler scanner
|
||||
|
||||
@ -20,7 +20,7 @@ JUMP_OPS = opc.JUMP_OPS
|
||||
class Scanner36(Scanner3):
|
||||
|
||||
def __init__(self, show_asm=None, is_pypy=False):
|
||||
Scanner3.__init__(self, 3.6, show_asm, is_pypy)
|
||||
Scanner3.__init__(self, (3, 6), show_asm, is_pypy)
|
||||
return
|
||||
|
||||
def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019 by Rocky Bernstein
|
||||
# Copyright (c) 2019, 2021 by Rocky Bernstein
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -33,7 +33,7 @@ JUMP_OPs = opc.JUMP_OPS
|
||||
|
||||
class Scanner39(Scanner38):
|
||||
def __init__(self, show_asm=None):
|
||||
Scanner37Base.__init__(self, 3.9, show_asm)
|
||||
Scanner37Base.__init__(self, (3, 9), show_asm)
|
||||
return
|
||||
|
||||
pass
|
||||
|
@ -149,7 +149,7 @@ def print_docstring(self, indent, docstring):
|
||||
# Must be unicode in Python2
|
||||
self.write('u')
|
||||
docstring = repr(docstring.expandtabs())[2:-1]
|
||||
elif PYTHON3 and 2.4 <= self.version <= 2.7:
|
||||
elif PYTHON3 and (2, 4) <= self.version[:2] <= (2, 7):
|
||||
try:
|
||||
repr(docstring.expandtabs())[1:-1].encode("ascii")
|
||||
except UnicodeEncodeError:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015-2020 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2021 by Rocky Bernstein
|
||||
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@ -192,7 +192,7 @@ def make_function2(self, node, is_lambda, nested=1, code_node=None):
|
||||
)
|
||||
|
||||
# Python 2 doesn't support the "nonlocal" statement
|
||||
assert self.version >= 3.0 or not nonlocals
|
||||
assert self.version >= (3, 0) or not nonlocals
|
||||
|
||||
for g in sorted((all_globals & self.mod_globs) | globals):
|
||||
self.println(self.indent, "global ", g)
|
||||
|
Loading…
x
Reference in New Issue
Block a user