bpo-12800: tarfile: Restore fix from 011525ee9 (GH-21409) · python/cpython@bda2e68 · GitHub
Skip to content

Commit bda2e68

Browse files
bpo-12800: tarfile: Restore fix from 011525e (GH-21409)
Restore fix from 011525e. (cherry picked from commit 4fedd71) Co-authored-by: Julien Palard <julien@palard.fr>
1 parent 8388a33 commit bda2e68

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

Lib/tarfile.py

Lines changed: 3 additions & 0 deletions

Lib/test/test_tarfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,10 +1314,10 @@ def test_extractall_symlinks(self):
13141314
f.write('something\n')
13151315
os.symlink(source_file, target_file)
13161316
with tarfile.open(temparchive, 'w') as tar:
1317-
tar.add(source_file)
1318-
tar.add(target_file)
1317+
tar.add(source_file, arcname="source")
1318+
tar.add(target_file, arcname="symlink")
13191319
# Let's extract it to the location which contains the symlink
1320-
with tarfile.open(temparchive) as tar:
1320+
with tarfile.open(temparchive, errorlevel=2) as tar:
13211321
# this should not raise OSError: [Errno 17] File exists
13221322
try:
13231323
tar.extractall(path=tempdir)
Lines changed: 4 additions & 0 deletions

0 commit comments

Comments
 (0)