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
5418ee0b
Kaydet (Commit)
5418ee0b
authored
Kas 15, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13333: The UTF-7 decoder now accepts lone surrogates
(the encoder already accepts them).
üst
c2fe5776
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
+20
-13
test_unicode.py
Lib/test/test_unicode.py
+12
-4
NEWS
Misc/NEWS
+3
-0
unicodeobject.c
Objects/unicodeobject.c
+5
-9
No files found.
Lib/test/test_unicode.py
Dosyayı görüntüle @
5418ee0b
...
...
@@ -1091,10 +1091,18 @@ class UnicodeTest(string_tests.CommonTest,
for
(
x
,
y
)
in
utfTests
:
self
.
assertEqual
(
x
.
encode
(
'utf-7'
),
y
)
# Unpaired surrogates not supported
self
.
assertRaises
(
UnicodeError
,
str
,
b
'+3ADYAA-'
,
'utf-7'
)
self
.
assertEqual
(
str
(
b
'+3ADYAA-'
,
'utf-7'
,
'replace'
),
'
\ufffd\ufffd
'
)
# Unpaired surrogates are passed through
self
.
assertEqual
(
'
\uD801
'
.
encode
(
'utf-7'
),
b
'+2AE-'
)
self
.
assertEqual
(
'
\uD801
x'
.
encode
(
'utf-7'
),
b
'+2AE-x'
)
self
.
assertEqual
(
'
\uDC01
'
.
encode
(
'utf-7'
),
b
'+3AE-'
)
self
.
assertEqual
(
'
\uDC01
x'
.
encode
(
'utf-7'
),
b
'+3AE-x'
)
self
.
assertEqual
(
b
'+2AE-'
.
decode
(
'utf-7'
),
'
\uD801
'
)
self
.
assertEqual
(
b
'+2AE-x'
.
decode
(
'utf-7'
),
'
\uD801
x'
)
self
.
assertEqual
(
b
'+3AE-'
.
decode
(
'utf-7'
),
'
\uDC01
'
)
self
.
assertEqual
(
b
'+3AE-x'
.
decode
(
'utf-7'
),
'
\uDC01
x'
)
self
.
assertEqual
(
'
\uD801\U000abcde
'
.
encode
(
'utf-7'
),
b
'+2AHab9ze-'
)
self
.
assertEqual
(
b
'+2AHab9ze-'
.
decode
(
'utf-7'
),
'
\uD801\U000abcde
'
)
# Issue #2242: crash on some Windows/MSVC versions
self
.
assertEqual
(
b
'+
\xc1
'
.
decode
(
'utf-7'
),
'
\xc1
'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
5418ee0b
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.3?
Core and Builtins
-----------------
- Issue #13333: The UTF-7 decoder now accepts lone surrogates (the encoder
already accepts them).
- Issue #13342: input() used to ignore sys.stdin's and sys.stdout's unicode
error handler in interactive mode (when calling into PyOS_Readline()).
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
5418ee0b
...
...
@@ -2282,21 +2282,17 @@ PyObject *PyUnicode_DecodeUTF7Stateful(const char *s,
*
p
++
=
outCh
;
#endif
surrogate
=
0
;
continue
;
}
else
{
*
p
++
=
surrogate
;
surrogate
=
0
;
errmsg = "second surrogate missing";
goto utf7Error;
}
}
else
if (outCh >= 0xD800 && outCh <= 0xDBFF) {
if
(
outCh
>=
0xD800
&&
outCh
<=
0xDBFF
)
{
/* first surrogate */
surrogate
=
outCh
;
}
else if (outCh >= 0xDC00 && outCh <= 0xDFFF) {
errmsg = "unexpected second surrogate";
goto utf7Error;
}
else
{
*
p
++
=
outCh
;
}
...
...
@@ -2306,8 +2302,8 @@ PyObject *PyUnicode_DecodeUTF7Stateful(const char *s,
inShift
=
0
;
s
++
;
if
(
surrogate
)
{
errmsg = "second surrogate missing at end of shift sequence"
;
goto utf7Error
;
*
p
++
=
surrogate
;
surrogate
=
0
;
}
if
(
base64bits
>
0
)
{
/* left-over bits */
if
(
base64bits
>=
6
)
{
...
...
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