diff options
author | Victor Stinner <vstinner@python.org> | 2023-12-03 11:18:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-03 11:18:24 (GMT) |
commit | d9e444dbb86e173ee5b8491e3facbd447b91eaed (patch) | |
tree | e7df87caad725a64d3646ec3d72dbd59211c9f03 /Tools | |
parent | 1f2a676785d48ed9ac01e60cc56a82e44b725474 (diff) | |
download | cpython-d9e444dbb86e173ee5b8491e3facbd447b91eaed.zip cpython-d9e444dbb86e173ee5b8491e3facbd447b91eaed.tar.gz cpython-d9e444dbb86e173ee5b8491e3facbd447b91eaed.tar.bz2 |
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.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/build/freeze_modules.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Tools/build/freeze_modules.py b/Tools/build/freeze_modules.py index c5a3971..6a54f45 100644 --- a/Tools/build/freeze_modules.py +++ b/Tools/build/freeze_modules.py @@ -468,6 +468,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): headerlines = [] parentdir = os.path.dirname(FROZEN_FILE) @@ -477,7 +488,7 @@ def regen_frozen(modules): header = relpath_for_posix_display(src.frozenfile, parentdir) headerlines.append(f'#include "{header}"') - externlines = [] + externlines = UniqueList() bootstraplines = [] stdliblines = [] testlines = [] |