Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
72d9b2be
Kaydet (Commit)
72d9b2be
authored
Şub 27, 2018
tarafından
Joffrey F
Kaydeden (comit)
Serhiy Storchaka
Şub 27, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32713: Fix tarfile.itn for large/negative float values. (GH-5434)
üst
eee72d47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
tarfile.py
Lib/tarfile.py
+2
-1
test_tarfile.py
Lib/test/test_tarfile.py
+8
-0
2018-02-26-13-16-36.bpo-32713.55yegW.rst
...S.d/next/Library/2018-02-26-13-16-36.bpo-32713.55yegW.rst
+1
-0
No files found.
Lib/tarfile.py
Dosyayı görüntüle @
72d9b2be
...
...
@@ -200,8 +200,9 @@ def itn(n, digits=8, format=DEFAULT_FORMAT):
# base-256 representation. This allows values up to (256**(digits-1))-1.
# A 0o200 byte indicates a positive number, a 0o377 byte a negative
# number.
n
=
int
(
n
)
if
0
<=
n
<
8
**
(
digits
-
1
):
s
=
bytes
(
"
%0*
o"
%
(
digits
-
1
,
int
(
n
)
),
"ascii"
)
+
NUL
s
=
bytes
(
"
%0*
o"
%
(
digits
-
1
,
n
),
"ascii"
)
+
NUL
elif
format
==
GNU_FORMAT
and
-
256
**
(
digits
-
1
)
<=
n
<
256
**
(
digits
-
1
):
if
n
>=
0
:
s
=
bytearray
([
0
o200
])
...
...
Lib/test/test_tarfile.py
Dosyayı görüntüle @
72d9b2be
...
...
@@ -2149,6 +2149,14 @@ class MiscTest(unittest.TestCase):
self
.
assertEqual
(
tarfile
.
itn
(
-
0x100000000000000
),
b
"
\xff\x00\x00\x00\x00\x00\x00\x00
"
)
# Issue 32713: Test if itn() supports float values outside the
# non-GNU format range
self
.
assertEqual
(
tarfile
.
itn
(
-
100.0
,
format
=
tarfile
.
GNU_FORMAT
),
b
"
\xff\xff\xff\xff\xff\xff\xff\x9c
"
)
self
.
assertEqual
(
tarfile
.
itn
(
8
**
12
+
0.0
,
format
=
tarfile
.
GNU_FORMAT
),
b
"
\x80\x00\x00\x10\x00\x00\x00\x00
"
)
self
.
assertEqual
(
tarfile
.
nti
(
tarfile
.
itn
(
-
0.1
,
format
=
tarfile
.
GNU_FORMAT
)),
0
)
def
test_number_field_limits
(
self
):
with
self
.
assertRaises
(
ValueError
):
tarfile
.
itn
(
-
1
,
8
,
tarfile
.
USTAR_FORMAT
)
...
...
Misc/NEWS.d/next/Library/2018-02-26-13-16-36.bpo-32713.55yegW.rst
0 → 100644
Dosyayı görüntüle @
72d9b2be
Fixed tarfile.itn handling of out-of-bounds float values. Patch by Joffrey Fuhrer.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment