Skip to content

Commit dac3d38

Browse files
authored
gh-104527: zippapp will now avoid appending an archive to itself. (gh-106076)
zippapp will now avoid appending an archive to itself.
1 parent a12e8ff commit dac3d38

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/zipapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def create_archive(source, target=None, interpreter=None, main=None,
138138
with zipfile.ZipFile(fd, 'w', compression=compression) as z:
139139
for child in sorted(source.rglob('*')):
140140
arcname = child.relative_to(source)
141-
if filter is None or filter(arcname):
141+
if filter is None or filter(arcname) and child.resolve() != arcname.resolve():
142142
z.write(child, arcname.as_posix())
143143
if main_py:
144144
z.writestr('__main__.py', main_py.encode('utf-8'))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Zipapp will now skip over apending an archive to itself.

0 commit comments

Comments
 (0)