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
58a10967
Unverified
Kaydet (Commit)
58a10967
authored
Şub 23, 2018
tarafından
INADA Naoki
Kaydeden (comit)
GitHub
Şub 23, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ipaddress: Use str.isascii() instead of frozenset (GH-5811)
üst
33dddac0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
ipaddress.py
Lib/ipaddress.py
+2
-3
No files found.
Lib/ipaddress.py
Dosyayı görüntüle @
58a10967
...
...
@@ -488,7 +488,7 @@ class _IPAddressBase:
"""
# int allows a leading +/- as well as surrounding whitespace,
# so we ensure that isn't the case
if
not
_BaseV4
.
_DECIMAL_DIGITS
.
issuperset
(
prefixlen_str
):
if
not
(
prefixlen_str
.
isascii
()
and
prefixlen_str
.
isdigit
()
):
cls
.
_report_invalid_netmask
(
prefixlen_str
)
try
:
prefixlen
=
int
(
prefixlen_str
)
...
...
@@ -1076,7 +1076,6 @@ class _BaseV4:
_version
=
4
# Equivalent to 255.255.255.255 or 32 bits of 1's.
_ALL_ONES
=
(
2
**
IPV4LENGTH
)
-
1
_DECIMAL_DIGITS
=
frozenset
(
'0123456789'
)
# the valid octets for host and netmasks. only useful for IPv4.
_valid_mask_octets
=
frozenset
({
255
,
254
,
252
,
248
,
240
,
224
,
192
,
128
,
0
})
...
...
@@ -1156,7 +1155,7 @@ class _BaseV4:
if
not
octet_str
:
raise
ValueError
(
"Empty octet not permitted"
)
# Whitelist the characters, since int() allows a lot of bizarre stuff.
if
not
cls
.
_DECIMAL_DIGITS
.
issuperset
(
octet_str
):
if
not
(
octet_str
.
isascii
()
and
octet_str
.
isdigit
()
):
msg
=
"Only decimal digits permitted in
%
r"
raise
ValueError
(
msg
%
octet_str
)
# We do the length check second, since the invalid character error
...
...
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