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
9768676f
Kaydet (Commit)
9768676f
authored
Kas 10, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Speed up IDNA for the common case
üst
de20b0b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
idna.py
Lib/encodings/idna.py
+22
-0
No files found.
Lib/encodings/idna.py
Dosyayı görüntüle @
9768676f
...
...
@@ -153,6 +153,20 @@ class Codec(codecs.Codec):
if
not
input
:
return
b
''
,
0
try
:
result
=
input
.
encode
(
'ascii'
)
except
UnicodeEncodeError
:
pass
else
:
# ASCII name: fast path
labels
=
result
.
split
(
b
'.'
)
for
label
in
labels
[:
-
1
]:
if
not
(
0
<
len
(
label
)
<
64
):
raise
UnicodeError
(
"label empty or too long"
)
if
len
(
labels
[
-
1
])
>=
64
:
raise
UnicodeError
(
"label too long"
)
return
result
,
len
(
input
)
result
=
bytearray
()
labels
=
dots
.
split
(
input
)
if
labels
and
not
labels
[
-
1
]:
...
...
@@ -179,6 +193,14 @@ class Codec(codecs.Codec):
if
not
isinstance
(
input
,
bytes
):
# XXX obviously wrong, see #3232
input
=
bytes
(
input
)
if
ace_prefix
not
in
input
:
# Fast path
try
:
return
input
.
decode
(
'ascii'
),
len
(
input
)
except
UnicodeDecodeError
:
pass
labels
=
input
.
split
(
b
"."
)
if
labels
and
len
(
labels
[
-
1
])
==
0
:
...
...
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