You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Merge pull request #504 from rocky/TABLE_DIRECT-pollution
Don't update global tables, copy them instead.
This commit is contained in:
@@ -64,7 +64,7 @@ jobs:
|
|||||||
# Test
|
# Test
|
||||||
# This would typically be a build job when using workflows, possibly combined with build
|
# This would typically be a build job when using workflows, possibly combined with build
|
||||||
# This is based on your 1.0 configuration file or project settings
|
# This is based on your 1.0 configuration file or project settings
|
||||||
- run: sudo python ./setup.py develop && make check-3.6
|
- run: sudo pip install -e . && make check-3.6
|
||||||
- run: cd ./test/stdlib && bash ./runtests.sh 'test_[p-z]*.py'
|
- run: cd ./test/stdlib && bash ./runtests.sh 'test_[p-z]*.py'
|
||||||
# Teardown
|
# Teardown
|
||||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||||
|
@@ -29,7 +29,6 @@ from uncompyle6.semantics.helper import flatten_list
|
|||||||
|
|
||||||
|
|
||||||
def customize_for_version(self, is_pypy, version):
|
def customize_for_version(self, is_pypy, version):
|
||||||
self.TABLE_DIRECT = TABLE_DIRECT.copy()
|
|
||||||
if is_pypy:
|
if is_pypy:
|
||||||
########################
|
########################
|
||||||
# PyPy changes
|
# PyPy changes
|
||||||
@@ -264,7 +263,6 @@ def customize_for_version(self, is_pypy, version):
|
|||||||
|
|
||||||
# < 3.0 continues
|
# < 3.0 continues
|
||||||
|
|
||||||
self.TABLE_R = TABLE_R.copy()
|
|
||||||
self.TABLE_R.update(
|
self.TABLE_R.update(
|
||||||
{
|
{
|
||||||
"STORE_SLICE+0": ("%c[:]", 0),
|
"STORE_SLICE+0": ("%c[:]", 0),
|
||||||
|
@@ -25,7 +25,7 @@ def customize_for_version25(self, version):
|
|||||||
########################
|
########################
|
||||||
# Import style for 2.5+
|
# Import style for 2.5+
|
||||||
########################
|
########################
|
||||||
TABLE_DIRECT.update(
|
self.TABLE_DIRECT.update(
|
||||||
{
|
{
|
||||||
"importmultiple": ("%|import %c%c\n", 2, 3),
|
"importmultiple": ("%|import %c%c\n", 2, 3),
|
||||||
"import_cont": (", %c", 2),
|
"import_cont": (", %c", 2),
|
||||||
|
@@ -19,7 +19,6 @@ from uncompyle6.semantics.consts import TABLE_DIRECT
|
|||||||
|
|
||||||
|
|
||||||
def customize_for_version26_27(self, version: tuple):
|
def customize_for_version26_27(self, version: tuple):
|
||||||
self.TABLE_DIRECT = TABLE_DIRECT.copy()
|
|
||||||
########################################
|
########################################
|
||||||
# Python 2.6+
|
# Python 2.6+
|
||||||
# except <condition> as <var>
|
# except <condition> as <var>
|
||||||
|
@@ -30,7 +30,6 @@ from uncompyle6.util import get_code_name
|
|||||||
|
|
||||||
|
|
||||||
def customize_for_version3(self, version: tuple):
|
def customize_for_version3(self, version: tuple):
|
||||||
self.TABLE_DIRECT = TABLE_DIRECT.copy()
|
|
||||||
self.TABLE_DIRECT.update(
|
self.TABLE_DIRECT.update(
|
||||||
{
|
{
|
||||||
"comp_for": (" for %c in %c", (2, "store"), (0, "expr")),
|
"comp_for": (" for %c in %c", (2, "store"), (0, "expr")),
|
||||||
|
@@ -26,7 +26,6 @@ from uncompyle6.semantics.helper import flatten_list, gen_function_parens_adjust
|
|||||||
#######################
|
#######################
|
||||||
def customize_for_version35(self, version: tuple):
|
def customize_for_version35(self, version: tuple):
|
||||||
# fmt: off
|
# fmt: off
|
||||||
self.TABLE_DIRECT = TABLE_DIRECT.copy()
|
|
||||||
self.TABLE_DIRECT.update(
|
self.TABLE_DIRECT.update(
|
||||||
{
|
{
|
||||||
# nested await expressions like:
|
# nested await expressions like:
|
||||||
|
@@ -96,7 +96,6 @@ def customize_for_version36(self, version: tuple):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.TABLE_R = TABLE_R.copy()
|
|
||||||
self.TABLE_R.update(
|
self.TABLE_R.update(
|
||||||
{
|
{
|
||||||
"CALL_FUNCTION_EX": ("%c(*%P)", 0, (1, 2, ", ", 100)),
|
"CALL_FUNCTION_EX": ("%c(*%P)", 0, (1, 2, ", ", 100)),
|
||||||
|
@@ -30,8 +30,6 @@ def customize_for_version37(self, version: tuple):
|
|||||||
# Python 3.7+ changes
|
# Python 3.7+ changes
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
self.TABLE_DIRECT = TABLE_DIRECT.copy()
|
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
PRECEDENCE["attribute37"] = 2
|
PRECEDENCE["attribute37"] = 2
|
||||||
PRECEDENCE["call_ex"] = 1
|
PRECEDENCE["call_ex"] = 1
|
||||||
|
@@ -29,8 +29,6 @@ def customize_for_version38(self, version: tuple):
|
|||||||
# for lhs in 'for forelsestmt forelselaststmt '
|
# for lhs in 'for forelsestmt forelselaststmt '
|
||||||
# 'forelselaststmtc tryfinally38'.split():
|
# 'forelselaststmtc tryfinally38'.split():
|
||||||
# del TABLE_DIRECT[lhs]
|
# del TABLE_DIRECT[lhs]
|
||||||
|
|
||||||
self.TABLE_DIRECT = TABLE_DIRECT.copy()
|
|
||||||
self.TABLE_DIRECT.update(
|
self.TABLE_DIRECT.update(
|
||||||
{
|
{
|
||||||
"async_for_stmt38": (
|
"async_for_stmt38": (
|
||||||
|
@@ -656,8 +656,6 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
|||||||
code = Code(cn.attr, self.scanner, self.currentclass)
|
code = Code(cn.attr, self.scanner, self.currentclass)
|
||||||
ast = self.build_ast(code._tokens, code._customize, code)
|
ast = self.build_ast(code._tokens, code._customize, code)
|
||||||
|
|
||||||
self.TABLE_DIRECT = TABLE_DIRECT.copy()
|
|
||||||
self.TABLE_R = TABLE_R.copy()
|
|
||||||
self.MAP_DIRECT = (self.TABLE_DIRECT,)
|
self.MAP_DIRECT = (self.TABLE_DIRECT,)
|
||||||
self.MAP_R = (self.TABLE_R, -1)
|
self.MAP_R = (self.TABLE_R, -1)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user