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
f8e7543d
Kaydet (Commit)
f8e7543d
authored
Agu 13, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.2 (#12732)
üst
98d95a50
f413b808
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
8 deletions
+30
-8
test_pep3131.py
Lib/test/test_pep3131.py
+3
-0
test_unicode.py
Lib/test/test_unicode.py
+1
-0
NEWS
Misc/NEWS
+3
-0
unicodeobject.c
Objects/unicodeobject.c
+23
-8
No files found.
Lib/test/test_pep3131.py
Dosyayı görüntüle @
f8e7543d
...
@@ -8,9 +8,12 @@ class PEP3131Test(unittest.TestCase):
...
@@ -8,9 +8,12 @@ class PEP3131Test(unittest.TestCase):
ä
=
1
ä
=
1
µ
=
2
# this is a compatibility character
µ
=
2
# this is a compatibility character
蟒
=
3
蟒
=
3
𝔘𝔫𝔦𝔠𝔬𝔡𝔢
=
4
self
.
assertEqual
(
getattr
(
T
,
"
\xe4
"
),
1
)
self
.
assertEqual
(
getattr
(
T
,
"
\xe4
"
),
1
)
self
.
assertEqual
(
getattr
(
T
,
"
\u03bc
"
),
2
)
self
.
assertEqual
(
getattr
(
T
,
"
\u03bc
"
),
2
)
self
.
assertEqual
(
getattr
(
T
,
'
\u87d2
'
),
3
)
self
.
assertEqual
(
getattr
(
T
,
'
\u87d2
'
),
3
)
v
=
getattr
(
T
,
"
\U0001d518\U0001d52b\U0001d526\U0001d520\U0001d52c\U0001d521\U0001d522
"
)
self
.
assertEqual
(
v
,
4
)
def
test_invalid
(
self
):
def
test_invalid
(
self
):
try
:
try
:
...
...
Lib/test/test_unicode.py
Dosyayı görüntüle @
f8e7543d
...
@@ -404,6 +404,7 @@ class UnicodeTest(string_tests.CommonTest,
...
@@ -404,6 +404,7 @@ class UnicodeTest(string_tests.CommonTest,
self
.
assertTrue
(
"bc"
.
isidentifier
())
self
.
assertTrue
(
"bc"
.
isidentifier
())
self
.
assertTrue
(
"b_"
.
isidentifier
())
self
.
assertTrue
(
"b_"
.
isidentifier
())
self
.
assertTrue
(
"µ"
.
isidentifier
())
self
.
assertTrue
(
"µ"
.
isidentifier
())
self
.
assertTrue
(
"𝔘𝔫𝔦𝔠𝔬𝔡𝔢"
.
isidentifier
())
self
.
assertFalse
(
" "
.
isidentifier
())
self
.
assertFalse
(
" "
.
isidentifier
())
self
.
assertFalse
(
"["
.
isidentifier
())
self
.
assertFalse
(
"["
.
isidentifier
())
...
...
Misc/NEWS
Dosyayı görüntüle @
f8e7543d
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #12732: In narrow unicode builds, allow Unicode identifiers which fall
outside the BMP.
- Issue #12575: Validate user-generated AST before it is compiled.
- Issue #12575: Validate user-generated AST before it is compiled.
- Make type(None), type(Ellipsis), and type(NotImplemented) callable. They
- Make type(None), type(Ellipsis), and type(NotImplemented) callable. They
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
f8e7543d
...
@@ -8044,14 +8044,30 @@ unicode_isnumeric(PyUnicodeObject *self)
...
@@ -8044,14 +8044,30 @@ unicode_isnumeric(PyUnicodeObject *self)
return
PyBool_FromLong
(
1
);
return
PyBool_FromLong
(
1
);
}
}
static
Py_UCS4
decode_ucs4
(
const
Py_UNICODE
*
s
,
Py_ssize_t
*
i
,
Py_ssize_t
size
)
{
Py_UCS4
ch
;
assert
(
*
i
<
size
);
ch
=
s
[(
*
i
)
++
];
#ifndef Py_UNICODE_WIDE
if
((
ch
&
0xfffffc00
)
==
0xd800
&&
*
i
<
size
&&
(
s
[
*
i
]
&
0xFFFFFC00
)
==
0xDC00
)
ch
=
((
Py_UCS4
)
ch
<<
10UL
)
+
(
Py_UCS4
)(
s
[(
*
i
)
++
])
-
0x35fdc00
;
#endif
return
ch
;
}
int
int
PyUnicode_IsIdentifier
(
PyObject
*
self
)
PyUnicode_IsIdentifier
(
PyObject
*
self
)
{
{
register
const
Py_UNICODE
*
p
=
PyUnicode_AS_UNICODE
((
PyUnicodeObject
*
)
self
);
Py_ssize_t
i
=
0
,
size
=
PyUnicode_GET_SIZE
(
self
);
register
const
Py_UNICODE
*
e
;
Py_UCS4
first
;
const
Py_UNICODE
*
p
=
PyUnicode_AS_UNICODE
((
PyUnicodeObject
*
)
self
);
/* Special case for empty strings */
/* Special case for empty strings */
if
(
PyUnicode_GET_SIZE
(
self
)
==
0
)
if
(
!
size
)
return
0
;
return
0
;
/* PEP 3131 says that the first character must be in
/* PEP 3131 says that the first character must be in
...
@@ -8062,14 +8078,13 @@ PyUnicode_IsIdentifier(PyObject *self)
...
@@ -8062,14 +8078,13 @@ PyUnicode_IsIdentifier(PyObject *self)
definition of XID_Start and XID_Continue, it is sufficient
definition of XID_Start and XID_Continue, it is sufficient
to check just for these, except that _ must be allowed
to check just for these, except that _ must be allowed
as starting an identifier. */
as starting an identifier. */
if
(
!
_PyUnicode_IsXidStart
(
*
p
)
&&
*
p
!=
0x5F
/* LOW LINE */
)
first
=
decode_ucs4
(
p
,
&
i
,
size
);
if
(
!
_PyUnicode_IsXidStart
(
first
)
&&
first
!=
0x5F
/* LOW LINE */
)
return
0
;
return
0
;
e
=
p
+
PyUnicode_GET_SIZE
(
self
);
while
(
i
<
size
)
for
(
p
++
;
p
<
e
;
p
++
)
{
if
(
!
_PyUnicode_IsXidContinue
(
decode_ucs4
(
p
,
&
i
,
size
)))
if
(
!
_PyUnicode_IsXidContinue
(
*
p
))
return
0
;
return
0
;
}
return
1
;
return
1
;
}
}
...
...
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