summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorCAM Gerlach <CAM.Gerlach@Gerlach.CAM>2019-03-21 14:44:51 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-03-21 14:44:51 (GMT)
commite680c3db80efc4a1d637dd871af21276db45ae03 (patch)
tree80df96129febac2d0a6bb1e8463f1785f96996ae /Lib
parented5e29cba500c2336aacdb7c77953f1064235b72 (diff)
downloadcpython-e680c3db80efc4a1d637dd871af21276db45ae03.zip
cpython-e680c3db80efc4a1d637dd871af21276db45ae03.tar.gz
cpython-e680c3db80efc4a1d637dd871af21276db45ae03.tar.bz2
bpo-36268: Change default tar format to pax from GNU. (GH-12355)
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/tarfile.py2
-rw-r--r--Lib/test/test_tarfile.py11
2 files changed, 7 insertions, 6 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index bb09d10..30cecff 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -105,7 +105,7 @@ SOLARIS_XHDTYPE = b"X" # Solaris extended header
USTAR_FORMAT = 0 # POSIX.1-1988 (ustar) format
GNU_FORMAT = 1 # GNU tar format
PAX_FORMAT = 2 # POSIX.1-2001 (pax) format
-DEFAULT_FORMAT = GNU_FORMAT
+DEFAULT_FORMAT = PAX_FORMAT
#---------------------------------------------------------
# tarfile constants
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 5e5a3c3..7e32cbc 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -2136,15 +2136,16 @@ class MiscTest(unittest.TestCase):
def test_write_number_fields(self):
self.assertEqual(tarfile.itn(1), b"0000001\x00")
self.assertEqual(tarfile.itn(0o7777777), b"7777777\x00")
- self.assertEqual(tarfile.itn(0o10000000),
+ self.assertEqual(tarfile.itn(0o10000000, format=tarfile.GNU_FORMAT),
b"\x80\x00\x00\x00\x00\x20\x00\x00")
- self.assertEqual(tarfile.itn(0xffffffff),
+ self.assertEqual(tarfile.itn(0xffffffff, format=tarfile.GNU_FORMAT),
b"\x80\x00\x00\x00\xff\xff\xff\xff")
- self.assertEqual(tarfile.itn(-1),
+ self.assertEqual(tarfile.itn(-1, format=tarfile.GNU_FORMAT),
b"\xff\xff\xff\xff\xff\xff\xff\xff")
- self.assertEqual(tarfile.itn(-100),
+ self.assertEqual(tarfile.itn(-100, format=tarfile.GNU_FORMAT),
b"\xff\xff\xff\xff\xff\xff\xff\x9c")
- self.assertEqual(tarfile.itn(-0x100000000000000),
+ self.assertEqual(tarfile.itn(-0x100000000000000,
+ format=tarfile.GNU_FORMAT),
b"\xff\x00\x00\x00\x00\x00\x00\x00")
# Issue 32713: Test if itn() supports float values outside the