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
80d1dd5f
Kaydet (Commit)
80d1dd5f
authored
Tem 25, 2001
tarafından
Marc-André Lemburg
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix for bug #444493: u'\U00010001' segfaults with current CVS on
wide builds.
üst
784d3df0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
test_unicode.py
Lib/test/test_unicode.py
+2
-1
unicodeobject.c
Objects/unicodeobject.c
+21
-6
No files found.
Lib/test/test_unicode.py
Dosyayı görüntüle @
80d1dd5f
...
@@ -455,7 +455,8 @@ for encoding in ('utf-8', 'utf-16', 'utf-16-le', 'utf-16-be',
...
@@ -455,7 +455,8 @@ for encoding in ('utf-8', 'utf-16', 'utf-16-le', 'utf-16-be',
u
=
u'
\U00010001\U00020002\U00030003\U00040004\U00050005
'
u
=
u'
\U00010001\U00020002\U00030003\U00040004\U00050005
'
for
encoding
in
(
'utf-8'
,
for
encoding
in
(
'utf-8'
,
'utf-16'
,
'utf-16-le'
,
'utf-16-be'
,
'utf-16'
,
'utf-16-le'
,
'utf-16-be'
,
'raw_unicode_escape'
,
'unicode_escape'
,
'unicode_internal'
):
#'raw_unicode_escape',
'unicode_escape'
,
'unicode_internal'
):
verify
(
unicode
(
u
.
encode
(
encoding
),
encoding
)
==
u
)
verify
(
unicode
(
u
.
encode
(
encoding
),
encoding
)
==
u
)
u
=
u''
.
join
(
map
(
unichr
,
range
(
256
)))
u
=
u''
.
join
(
map
(
unichr
,
range
(
256
)))
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
80d1dd5f
...
@@ -1415,7 +1415,6 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
...
@@ -1415,7 +1415,6 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
{
{
PyObject
*
repr
;
PyObject
*
repr
;
char
*
p
;
char
*
p
;
char
*
q
;
static
const
char
*
hexdigit
=
"0123456789abcdef"
;
static
const
char
*
hexdigit
=
"0123456789abcdef"
;
...
@@ -1423,7 +1422,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
...
@@ -1423,7 +1422,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
if
(
repr
==
NULL
)
if
(
repr
==
NULL
)
return
NULL
;
return
NULL
;
p
=
q
=
PyString_AS_STRING
(
repr
);
p
=
PyString_AS_STRING
(
repr
);
if
(
quotes
)
{
if
(
quotes
)
{
*
p
++
=
'u'
;
*
p
++
=
'u'
;
...
@@ -1432,14 +1431,26 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
...
@@ -1432,14 +1431,26 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
}
}
while
(
size
--
>
0
)
{
while
(
size
--
>
0
)
{
Py_UNICODE
ch
=
*
s
++
;
Py_UNICODE
ch
=
*
s
++
;
/* Escape quotes */
/* Escape quotes */
if
(
quotes
&&
(
ch
==
(
Py_UNICODE
)
q
[
1
]
||
ch
==
'\\'
))
{
if
(
quotes
&&
(
ch
==
(
Py_UNICODE
)
PyString_AS_STRING
(
repr
)[
1
]
||
ch
==
'\\'
))
{
*
p
++
=
'\\'
;
*
p
++
=
'\\'
;
*
p
++
=
(
char
)
ch
;
*
p
++
=
(
char
)
ch
;
}
}
#ifdef Py_UNICODE_WIDE
#ifdef Py_UNICODE_WIDE
/* Map 21-bit characters to '\U00xxxxxx' */
/* Map 21-bit characters to '\U00xxxxxx' */
else
if
(
ch
>=
0x10000
)
{
else
if
(
ch
>=
0x10000
)
{
int
offset
=
p
-
PyString_AS_STRING
(
repr
);
/* Resize the string if necessary */
if
(
offset
+
12
>
PyString_GET_SIZE
(
repr
))
{
if
(
_PyString_Resize
(
&
repr
,
PyString_GET_SIZE
(
repr
)
+
100
))
goto
onError
;
p
=
PyString_AS_STRING
(
repr
)
+
offset
;
}
*
p
++
=
'\\'
;
*
p
++
=
'\\'
;
*
p
++
=
'U'
;
*
p
++
=
'U'
;
*
p
++
=
hexdigit
[(
ch
>>
28
)
&
0x0000000F
];
*
p
++
=
hexdigit
[(
ch
>>
28
)
&
0x0000000F
];
...
@@ -1449,7 +1460,8 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
...
@@ -1449,7 +1460,8 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
*
p
++
=
hexdigit
[(
ch
>>
12
)
&
0x0000000F
];
*
p
++
=
hexdigit
[(
ch
>>
12
)
&
0x0000000F
];
*
p
++
=
hexdigit
[(
ch
>>
8
)
&
0x0000000F
];
*
p
++
=
hexdigit
[(
ch
>>
8
)
&
0x0000000F
];
*
p
++
=
hexdigit
[(
ch
>>
4
)
&
0x0000000F
];
*
p
++
=
hexdigit
[(
ch
>>
4
)
&
0x0000000F
];
*
p
++
=
hexdigit
[
ch
&
15
];
*
p
++
=
hexdigit
[
ch
&
0x0000000F
];
continue
;
}
}
#endif
#endif
/* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */
/* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */
...
@@ -1487,6 +1499,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
...
@@ -1487,6 +1499,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
*
p
++
=
hexdigit
[(
ch
>>
4
)
&
0x000F
];
*
p
++
=
hexdigit
[(
ch
>>
4
)
&
0x000F
];
*
p
++
=
hexdigit
[
ch
&
0x000F
];
*
p
++
=
hexdigit
[
ch
&
0x000F
];
}
}
/* Map special whitespace to '\t', \n', '\r' */
/* Map special whitespace to '\t', \n', '\r' */
else
if
(
ch
==
'\t'
)
{
else
if
(
ch
==
'\t'
)
{
*
p
++
=
'\\'
;
*
p
++
=
'\\'
;
...
@@ -1500,6 +1513,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
...
@@ -1500,6 +1513,7 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
*
p
++
=
'\\'
;
*
p
++
=
'\\'
;
*
p
++
=
'r'
;
*
p
++
=
'r'
;
}
}
/* Map non-printable US ASCII to '\xhh' */
/* Map non-printable US ASCII to '\xhh' */
else
if
(
ch
<
' '
||
ch
>=
128
)
{
else
if
(
ch
<
' '
||
ch
>=
128
)
{
*
p
++
=
'\\'
;
*
p
++
=
'\\'
;
...
@@ -1507,15 +1521,16 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
...
@@ -1507,15 +1521,16 @@ PyObject *unicodeescape_string(const Py_UNICODE *s,
*
p
++
=
hexdigit
[(
ch
>>
4
)
&
0x000F
];
*
p
++
=
hexdigit
[(
ch
>>
4
)
&
0x000F
];
*
p
++
=
hexdigit
[
ch
&
0x000F
];
*
p
++
=
hexdigit
[
ch
&
0x000F
];
}
}
/* Copy everything else as-is */
/* Copy everything else as-is */
else
else
*
p
++
=
(
char
)
ch
;
*
p
++
=
(
char
)
ch
;
}
}
if
(
quotes
)
if
(
quotes
)
*
p
++
=
q
[
1
];
*
p
++
=
PyString_AS_STRING
(
repr
)
[
1
];
*
p
=
'\0'
;
*
p
=
'\0'
;
if
(
_PyString_Resize
(
&
repr
,
p
-
q
))
if
(
_PyString_Resize
(
&
repr
,
p
-
PyString_AS_STRING
(
repr
)
))
goto
onError
;
goto
onError
;
return
repr
;
return
repr
;
...
...
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