summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-12-03 11:54:59 (GMT)
committerGitHub <noreply@github.com>2023-12-03 11:54:59 (GMT)
commit34d57d5871673ba3ed115a5bd7ede9c63effd05c (patch)
tree3f2ecf5badbdbec17df6bd84ad37ecc52dd8cdce /Tools
parent05f5d416de88353d4f4568d0e30a22a7f23ba487 (diff)
downloadcpython-34d57d5871673ba3ed115a5bd7ede9c63effd05c.zip
cpython-34d57d5871673ba3ed115a5bd7ede9c63effd05c.tar.gz
cpython-34d57d5871673ba3ed115a5bd7ede9c63effd05c.tar.bz2
[3.12] gh-106560: Fix redundant declarations in Python/frozen.c (#112612) (#112651)
gh-106560: Fix redundant declarations in Python/frozen.c (#112612) Avoid duplicated declarations of "extern" functions in Python/frozen.c. Compiler warnings seen by building Python with gcc -Wredundant-decls. (cherry picked from commit d9e444dbb86e173ee5b8491e3facbd447b91eaed)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/build/freeze_modules.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Tools/build/freeze_modules.py b/Tools/build/freeze_modules.py
index 1220097..5e3bd1f 100644
--- a/Tools/build/freeze_modules.py
+++ b/Tools/build/freeze_modules.py
@@ -467,6 +467,17 @@ def replace_block(lines, start_marker, end_marker, replacements, file):
return lines[:start_pos + 1] + replacements + lines[end_pos:]
+class UniqueList(list):
+ def __init__(self):
+ self._seen = set()
+
+ def append(self, item):
+ if item in self._seen:
+ return
+ super().append(item)
+ self._seen.add(item)
+
+
def regen_frozen(modules, frozen_modules: bool):
headerlines = []
parentdir = os.path.dirname(FROZEN_FILE)
@@ -477,7 +488,7 @@ def regen_frozen(modules, frozen_modules: bool):
header = relpath_for_posix_display(src.frozenfile, parentdir)
headerlines.append(f'#include "{header}"')
- externlines = []
+ externlines = UniqueList()
bootstraplines = []
stdliblines = []
testlines = []