Skip to content

Commit

Permalink
Merge pull request #504 from rocky/TABLE_DIRECT-pollution
Browse files Browse the repository at this point in the history
Don't update global tables, copy them instead.
  • Loading branch information
rocky authored Nov 12, 2024
2 parents 37f38e4 + 5c391f9 commit 2786cbc
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions uncompyle6/semantics/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


def customize_for_version(self, is_pypy, version):
self.TABLE_DIRECT = TABLE_DIRECT.copy()
if is_pypy:
########################
# PyPy changes
Expand Down Expand Up @@ -264,7 +263,6 @@ def n_call(node):

# < 3.0 continues

self.TABLE_R = TABLE_R.copy()
self.TABLE_R.update(
{
"STORE_SLICE+0": ("%c[:]", 0),
Expand Down
2 changes: 1 addition & 1 deletion uncompyle6/semantics/customize25.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion uncompyle6/semantics/customize26_27.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


def customize_for_version26_27(self, version: tuple):
self.TABLE_DIRECT = TABLE_DIRECT.copy()
########################################
# Python 2.6+
# except <condition> as <var>
Expand Down
1 change: 0 additions & 1 deletion uncompyle6/semantics/customize3.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


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")),
Expand Down
1 change: 0 additions & 1 deletion uncompyle6/semantics/customize35.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#######################
def customize_for_version35(self, version: tuple):
# fmt: off
self.TABLE_DIRECT = TABLE_DIRECT.copy()
self.TABLE_DIRECT.update(
{
# nested await expressions like:
Expand Down
1 change: 0 additions & 1 deletion uncompyle6/semantics/customize36.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
2 changes: 0 additions & 2 deletions uncompyle6/semantics/customize37.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions uncompyle6/semantics/customize38.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": (
Expand Down
2 changes: 0 additions & 2 deletions uncompyle6/semantics/fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,6 @@ def comprehension_walk(self, node, iter_index, code_index=-5):
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)

Expand Down

0 comments on commit 2786cbc

Please sign in to comment.