You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
More Python version comparison adjustments
This commit is contained in:
@@ -644,6 +644,8 @@ def get_python_parser(
|
|||||||
if isinstance(version, str):
|
if isinstance(version, str):
|
||||||
version = tuple([int(v) for v in version.split(".")[:2]])
|
version = tuple([int(v) for v in version.split(".")[:2]])
|
||||||
|
|
||||||
|
version = version[:2]
|
||||||
|
|
||||||
# FIXME: there has to be a better way...
|
# FIXME: there has to be a better way...
|
||||||
# We could do this as a table lookup, but that would force us
|
# We could do this as a table lookup, but that would force us
|
||||||
# in import all of the parsers all of the time. Perhaps there is
|
# in import all of the parsers all of the time. Perhaps there is
|
||||||
|
@@ -209,7 +209,7 @@ class Python37BaseParser(PythonParser):
|
|||||||
stmt ::= async_with_as_stmt
|
stmt ::= async_with_as_stmt
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.version < 3.8:
|
if self.version < (3, 8):
|
||||||
rules_str += """
|
rules_str += """
|
||||||
stmt ::= async_with_stmt SETUP_ASYNC_WITH
|
stmt ::= async_with_stmt SETUP_ASYNC_WITH
|
||||||
c_stmt ::= c_async_with_stmt SETUP_ASYNC_WITH
|
c_stmt ::= c_async_with_stmt SETUP_ASYNC_WITH
|
||||||
|
@@ -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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,7 +28,7 @@ def customize_for_version26_27(self, version):
|
|||||||
# For 2.6 we use the older syntax which
|
# For 2.6 we use the older syntax which
|
||||||
# matches how we parse this in bytecode
|
# matches how we parse this in bytecode
|
||||||
########################################
|
########################################
|
||||||
if version > 2.6:
|
if version > (2, 6):
|
||||||
TABLE_DIRECT.update({
|
TABLE_DIRECT.update({
|
||||||
'except_cond2': ( '%|except %c as %c:\n', 1, 5 ),
|
'except_cond2': ( '%|except %c as %c:\n', 1, 5 ),
|
||||||
# When a generator is a single parameter of a function,
|
# When a generator is a single parameter of a function,
|
||||||
|
Reference in New Issue
Block a user