Merge pull request #504 from rocky/TABLE_DIRECT-pollution
Some checks failed
uncompyle6 (osx) / build (macOS, 3.8) (push) Has been cancelled
uncompyle6 (ubuntu) / build (3.8) (push) Has been cancelled
uncompyle6 (windows) / build (windows, 3.8) (push) Has been cancelled

Don't update global tables, copy them instead.
This commit is contained in:
R. Bernstein 2024-11-12 16:38:40 -05:00 committed by GitHub
commit 2786cbcb89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 2 additions and 14 deletions

View File

@ -64,7 +64,7 @@ jobs:
# Test
# 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
- 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'
# 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

View File

@ -29,7 +29,6 @@ from uncompyle6.semantics.helper import flatten_list
def customize_for_version(self, is_pypy, version):
self.TABLE_DIRECT = TABLE_DIRECT.copy()
if is_pypy:
########################
# PyPy changes
@ -264,7 +263,6 @@ def customize_for_version(self, is_pypy, version):
# < 3.0 continues
self.TABLE_R = TABLE_R.copy()
self.TABLE_R.update(
{
"STORE_SLICE+0": ("%c[:]", 0),

View File

@ -25,7 +25,7 @@ def customize_for_version25(self, version):
########################
# Import style for 2.5+
########################
TABLE_DIRECT.update(
self.TABLE_DIRECT.update(
{
"importmultiple": ("%|import %c%c\n", 2, 3),
"import_cont": (", %c", 2),

View File

@ -19,7 +19,6 @@ from uncompyle6.semantics.consts import TABLE_DIRECT
def customize_for_version26_27(self, version: tuple):
self.TABLE_DIRECT = TABLE_DIRECT.copy()
########################################
# Python 2.6+
# except <condition> as <var>

View File

@ -30,7 +30,6 @@ from uncompyle6.util import get_code_name
def customize_for_version3(self, version: tuple):
self.TABLE_DIRECT = TABLE_DIRECT.copy()
self.TABLE_DIRECT.update(
{
"comp_for": (" for %c in %c", (2, "store"), (0, "expr")),

View File

@ -26,7 +26,6 @@ from uncompyle6.semantics.helper import flatten_list, gen_function_parens_adjust
#######################
def customize_for_version35(self, version: tuple):
# fmt: off
self.TABLE_DIRECT = TABLE_DIRECT.copy()
self.TABLE_DIRECT.update(
{
# nested await expressions like:

View File

@ -96,7 +96,6 @@ def customize_for_version36(self, version: tuple):
}
)
self.TABLE_R = TABLE_R.copy()
self.TABLE_R.update(
{
"CALL_FUNCTION_EX": ("%c(*%P)", 0, (1, 2, ", ", 100)),

View File

@ -30,8 +30,6 @@ def customize_for_version37(self, version: tuple):
# Python 3.7+ changes
#######################
self.TABLE_DIRECT = TABLE_DIRECT.copy()
# fmt: off
PRECEDENCE["attribute37"] = 2
PRECEDENCE["call_ex"] = 1

View File

@ -29,8 +29,6 @@ def customize_for_version38(self, version: tuple):
# for lhs in 'for forelsestmt forelselaststmt '
# 'forelselaststmtc tryfinally38'.split():
# del TABLE_DIRECT[lhs]
self.TABLE_DIRECT = TABLE_DIRECT.copy()
self.TABLE_DIRECT.update(
{
"async_for_stmt38": (

View File

@ -656,8 +656,6 @@ class FragmentsWalker(pysource.SourceWalker, object):
code = Code(cn.attr, self.scanner, self.currentclass)
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_R = (self.TABLE_R, -1)