summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGabriel Venberg <gabevenberg@gmail.com>2023-06-26 09:09:08 (GMT)
committerGitHub <noreply@github.com>2023-06-26 09:09:08 (GMT)
commitdac3d389e747c6f6ef17e4e2f38731c8ef83eada (patch)
tree72dae20fcf68fb01b53651575bbb31f606a2c5bd /Lib
parenta12e8ffb49e05a1d1874389318911ce9685db232 (diff)
downloadcpython-dac3d389e747c6f6ef17e4e2f38731c8ef83eada.zip
cpython-dac3d389e747c6f6ef17e4e2f38731c8ef83eada.tar.gz
cpython-dac3d389e747c6f6ef17e4e2f38731c8ef83eada.tar.bz2
gh-104527: zippapp will now avoid appending an archive to itself. (gh-106076)
zippapp will now avoid appending an archive to itself.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/zipapp.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/zipapp.py b/Lib/zipapp.py
index d8ebfcb..03a214e 100644
--- a/Lib/zipapp.py
+++ b/Lib/zipapp.py
@@ -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'))