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
48070c12
Commit
48070c12
authored
Mar 29, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23803: Fixed str.partition() and str.rpartition() when a separator
is wider then partitioned string.
parent
9db55004
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
Lib/test/test_unicode.py
Lib/test/test_unicode.py
+2
-0
Misc/NEWS
Misc/NEWS
+3
-0
Objects/unicodeobject.c
Objects/unicodeobject.c
+5
-5
No files found.
Lib/test/test_unicode.py
View file @
48070c12
...
@@ -375,6 +375,7 @@ class UnicodeTest(string_tests.CommonTest,
...
@@ -375,6 +375,7 @@ class UnicodeTest(string_tests.CommonTest,
def
test_partition
(
self
):
def
test_partition
(
self
):
string_tests
.
MixinStrUnicodeUserStringTest
.
test_partition
(
self
)
string_tests
.
MixinStrUnicodeUserStringTest
.
test_partition
(
self
)
# test mixed kinds
# test mixed kinds
self
.
checkequal
((
'ABCDEFGH'
,
''
,
''
),
'ABCDEFGH'
,
'partition'
,
'
\
u4200
'
)
for
left
,
right
in
(
'ba'
,
'
\
u0101
\
u0100
'
,
'
\
U00010301
\
U00010300
'
):
for
left
,
right
in
(
'ba'
,
'
\
u0101
\
u0100
'
,
'
\
U00010301
\
U00010300
'
):
left
*=
9
left
*=
9
right
*=
9
right
*=
9
...
@@ -391,6 +392,7 @@ class UnicodeTest(string_tests.CommonTest,
...
@@ -391,6 +392,7 @@ class UnicodeTest(string_tests.CommonTest,
def
test_rpartition
(
self
):
def
test_rpartition
(
self
):
string_tests
.
MixinStrUnicodeUserStringTest
.
test_rpartition
(
self
)
string_tests
.
MixinStrUnicodeUserStringTest
.
test_rpartition
(
self
)
# test mixed kinds
# test mixed kinds
self
.
checkequal
((
''
,
''
,
'ABCDEFGH'
),
'ABCDEFGH'
,
'rpartition'
,
'
\
u4200
'
)
for
left
,
right
in
(
'ba'
,
'
\
u0101
\
u0100
'
,
'
\
U00010301
\
U00010300
'
):
for
left
,
right
in
(
'ba'
,
'
\
u0101
\
u0100
'
,
'
\
U00010301
\
U00010300
'
):
left
*=
9
left
*=
9
right
*=
9
right
*=
9
...
...
Misc/NEWS
View file @
48070c12
...
@@ -10,6 +10,9 @@ Release date: tba
...
@@ -10,6 +10,9 @@ Release date: tba
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #23803: Fixed str.partition() and str.rpartition() when a separator
is wider then partitioned string.
- Issue #23192: Fixed generator lambdas. Patch by Bruno Cauet.
- Issue #23192: Fixed generator lambdas. Patch by Bruno Cauet.
- Issue #23629: Fix the default __sizeof__ implementation for variable-sized
- Issue #23629: Fix the default __sizeof__ implementation for variable-sized
...
...
Objects/unicodeobject.c
View file @
48070c12
...
@@ -12681,7 +12681,7 @@ PyUnicode_Partition(PyObject *str_in, PyObject *sep_in)
...
@@ -12681,7 +12681,7 @@ PyUnicode_Partition(PyObject *str_in, PyObject *sep_in)
len1
=
PyUnicode_GET_LENGTH
(
str_obj
);
len1
=
PyUnicode_GET_LENGTH
(
str_obj
);
len2
=
PyUnicode_GET_LENGTH
(
sep_obj
);
len2
=
PyUnicode_GET_LENGTH
(
sep_obj
);
switch
(
PyUnicode_KIND
(
str_obj
)
)
{
switch
(
kind
)
{
case
PyUnicode_1BYTE_KIND
:
case
PyUnicode_1BYTE_KIND
:
if
(
PyUnicode_IS_ASCII
(
str_obj
)
&&
PyUnicode_IS_ASCII
(
sep_obj
))
if
(
PyUnicode_IS_ASCII
(
str_obj
)
&&
PyUnicode_IS_ASCII
(
sep_obj
))
out
=
asciilib_partition
(
str_obj
,
buf1
,
len1
,
sep_obj
,
buf2
,
len2
);
out
=
asciilib_partition
(
str_obj
,
buf1
,
len1
,
sep_obj
,
buf2
,
len2
);
...
@@ -12737,12 +12737,12 @@ PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in)
...
@@ -12737,12 +12737,12 @@ PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in)
return
NULL
;
return
NULL
;
}
}
kind1
=
PyUnicode_KIND
(
str_
in
);
kind1
=
PyUnicode_KIND
(
str_
obj
);
kind2
=
PyUnicode_KIND
(
sep_obj
);
kind2
=
PyUnicode_KIND
(
sep_obj
);
kind
=
Py_MAX
(
kind1
,
kind2
);
kind
=
Py_MAX
(
kind1
,
kind2
);
buf1
=
PyUnicode_DATA
(
str_
in
);
buf1
=
PyUnicode_DATA
(
str_
obj
);
if
(
kind1
!=
kind
)
if
(
kind1
!=
kind
)
buf1
=
_PyUnicode_AsKind
(
str_
in
,
kind
);
buf1
=
_PyUnicode_AsKind
(
str_
obj
,
kind
);
if
(
!
buf1
)
if
(
!
buf1
)
goto
onError
;
goto
onError
;
buf2
=
PyUnicode_DATA
(
sep_obj
);
buf2
=
PyUnicode_DATA
(
sep_obj
);
...
@@ -12753,7 +12753,7 @@ PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in)
...
@@ -12753,7 +12753,7 @@ PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in)
len1
=
PyUnicode_GET_LENGTH
(
str_obj
);
len1
=
PyUnicode_GET_LENGTH
(
str_obj
);
len2
=
PyUnicode_GET_LENGTH
(
sep_obj
);
len2
=
PyUnicode_GET_LENGTH
(
sep_obj
);
switch
(
PyUnicode_KIND
(
str_in
)
)
{
switch
(
kind
)
{
case
PyUnicode_1BYTE_KIND
:
case
PyUnicode_1BYTE_KIND
:
if
(
PyUnicode_IS_ASCII
(
str_obj
)
&&
PyUnicode_IS_ASCII
(
sep_obj
))
if
(
PyUnicode_IS_ASCII
(
str_obj
)
&&
PyUnicode_IS_ASCII
(
sep_obj
))
out
=
asciilib_rpartition
(
str_obj
,
buf1
,
len1
,
sep_obj
,
buf2
,
len2
);
out
=
asciilib_rpartition
(
str_obj
,
buf1
,
len1
,
sep_obj
,
buf2
,
len2
);
...
...
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