gh-104527: zippapp will now avoid appending an archive to itself. (gh-106076)

zippapp will now avoid appending an archive to itself.
This commit is contained in:
Gabriel Venberg 2023-06-26 04:09:08 -05:00 committed by GitHub
parent a12e8ffb49
commit dac3d389e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -138,7 +138,7 @@ def create_archive(source, target=None, interpreter=None, main=None,
with zipfile.ZipFile(fd, 'w', compression=compression) as z:
for child in sorted(source.rglob('*')):
arcname = child.relative_to(source)
if filter is None or filter(arcname):
if filter is None or filter(arcname) and child.resolve() != arcname.resolve():
z.write(child, arcname.as_posix())
if main_py:
z.writestr('__main__.py', main_py.encode('utf-8'))

View File

@ -0,0 +1 @@
Zipapp will now skip over apending an archive to itself.