Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c1f56d45
Commit
c1f56d45
authored
Dec 23, 2010
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #10254: Fixed a crash and a regression introduced by the implementation of PRI 29.
parent
0ed24380
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
8 deletions
+23
-8
Lib/test/test_normalization.py
Lib/test/test_normalization.py
+0
-3
Lib/test/test_unicodedata.py
Lib/test/test_unicodedata.py
+14
-1
Modules/unicodedata.c
Modules/unicodedata.c
+9
-4
No files found.
Lib/test/test_normalization.py
View file @
c1f56d45
...
...
@@ -55,9 +55,6 @@ class NormalizationTest(unittest.TestCase):
if
line
.
startswith
(
"@Part"
):
part
=
line
.
split
()[
0
]
continue
if
part
==
"@Part3"
:
# XXX we don't support PRI #29 yet, so skip these tests for now
continue
try
:
c1
,
c2
,
c3
,
c4
,
c5
=
[
unistr
(
x
)
for
x
in
line
.
split
(
';'
)[:
-
1
]]
except
RangeError
:
...
...
Lib/test/test_unicodedata.py
View file @
c1f56d45
...
...
@@ -188,9 +188,22 @@ class UnicodeFunctionsTest(UnicodeDatabaseTest):
def
test_pr29
(
self
):
# http://www.unicode.org/review/pr-29.html
for
text
in
(
"
\
u0b47
\
u0300
\
u0b3e
"
,
"
\
u1100
\
u0300
\
u1161
"
):
# See issues #1054943 and #10254.
composed
=
(
"
\
u0b47
\
u0300
\
u0b3e
"
,
"
\
u1100
\
u0300
\
u1161
"
,
'Li
\
u030d
t-s
\
u1e73
\
u0301
'
,
'
\
u092e
\
u093e
\
u0930
\
u094d
\
u0915
\
u091c
\
u093c
'
+
'
\
u0941
\
u0915
\
u0947
\
u0930
\
u092c
\
u0930
\
u094d
\
u0917
'
,
'
\
u0915
\
u093f
\
u0930
\
u094d
\
u0917
\
u093f
\
u091c
\
u093c
'
+
'
\
u0938
\
u094d
\
u0924
\
u093e
\
u0928
'
)
for
text
in
composed
:
self
.
assertEqual
(
self
.
db
.
normalize
(
'NFC'
,
text
),
text
)
def
test_issue10254
(
self
):
# Crash reported in #10254
a
=
'C
\
u0338
'
*
20
+
'C
\
u0327
'
b
=
'C
\
u0338
'
*
20
+
'
\
xC7
'
self
.
assertEqual
(
self
.
db
.
normalize
(
'NFC'
,
a
),
b
)
def
test_east_asian_width
(
self
):
eaw
=
self
.
db
.
east_asian_width
self
.
assertRaises
(
TypeError
,
eaw
,
b'a'
)
...
...
Modules/unicodedata.c
View file @
c1f56d45
...
...
@@ -684,11 +684,15 @@ nfc_nfkc(PyObject *self, PyObject *input, int k)
comb
=
0
;
while
(
i1
<
end
)
{
int
comb1
=
_getrecord_ex
(
*
i1
)
->
combining
;
if
(
comb
&&
(
comb1
==
0
||
comb
==
comb1
))
{
if
(
comb
)
{
if
(
comb1
==
0
)
break
;
if
(
comb
>=
comb1
)
{
/* Character is blocked. */
i1
++
;
continue
;
}
}
l
=
find_nfc_index
(
self
,
nfc_last
,
*
i1
);
/* *i1 cannot be combined with *i. If *i1
is a starter, we don't need to look further.
...
...
@@ -711,6 +715,7 @@ nfc_nfkc(PyObject *self, PyObject *input, int k)
/* Replace the original character. */
*
i
=
code
;
/* Mark the second character unused. */
assert
(
cskipped
<
20
);
skipped
[
cskipped
++
]
=
i1
;
i1
++
;
f
=
find_nfc_index
(
self
,
nfc_first
,
*
i
);
...
...
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