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
185ac8a7
Commit
185ac8a7
authored
Sep 04, 2006
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix endcase for str.rpartition()
parent
f749693a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
Doc/lib/libstdtypes.tex
Doc/lib/libstdtypes.tex
+2
-2
Lib/test/string_tests.py
Lib/test/string_tests.py
+1
-1
Objects/stringlib/partition.h
Objects/stringlib/partition.h
+4
-4
Objects/stringobject.c
Objects/stringobject.c
+2
-2
Objects/unicodeobject.c
Objects/unicodeobject.c
+2
-2
No files found.
Doc/lib/libstdtypes.tex
View file @
185ac8a7
...
...
@@ -771,8 +771,8 @@ The original string is returned if
Split the string at the last occurrence of
\var
{
sep
}
, and return
a 3-tuple containing the part before the separator, the separator
itself, and the part after the separator. If the separator is not
found, return a 3-tuple containing t
he string itself
, followed by
t
wo empty strings
.
found, return a 3-tuple containing t
wo empty strings
, followed by
t
he string itself
.
\versionadded
{
2.5
}
\end{methoddesc}
...
...
Lib/test/string_tests.py
View file @
185ac8a7
...
...
@@ -1069,7 +1069,7 @@ class MixinStrUnicodeUserStringTest:
# from raymond's original specification
S
=
'http://www.python.org'
self
.
checkequal
((
'http'
,
'://'
,
'www.python.org'
),
S
,
'rpartition'
,
'://'
)
self
.
checkequal
((
'
http://www.python.org'
,
''
,
'
'
),
S
,
'rpartition'
,
'?'
)
self
.
checkequal
((
'
'
,
''
,
'http://www.python.org
'
),
S
,
'rpartition'
,
'?'
)
self
.
checkequal
((
''
,
'http://'
,
'www.python.org'
),
S
,
'rpartition'
,
'http://'
)
self
.
checkequal
((
'http://www.python.'
,
'org'
,
''
),
S
,
'rpartition'
,
'org'
)
...
...
Objects/stringlib/partition.h
View file @
185ac8a7
...
...
@@ -78,12 +78,12 @@ stringlib_rpartition(
}
if
(
pos
<
0
)
{
Py_INCREF
(
str_obj
);
PyTuple_SET_ITEM
(
out
,
0
,
(
PyObject
*
)
str_obj
);
Py_INCREF
(
STRINGLIB_EMPTY
);
PyTuple_SET_ITEM
(
out
,
1
,
(
PyObject
*
)
STRINGLIB_EMPTY
);
PyTuple_SET_ITEM
(
out
,
0
,
(
PyObject
*
)
STRINGLIB_EMPTY
);
Py_INCREF
(
STRINGLIB_EMPTY
);
PyTuple_SET_ITEM
(
out
,
2
,
(
PyObject
*
)
STRINGLIB_EMPTY
);
PyTuple_SET_ITEM
(
out
,
1
,
(
PyObject
*
)
STRINGLIB_EMPTY
);
Py_INCREF
(
str_obj
);
PyTuple_SET_ITEM
(
out
,
2
,
(
PyObject
*
)
str_obj
);
return
out
;
}
...
...
Objects/stringobject.c
View file @
185ac8a7
...
...
@@ -1543,11 +1543,11 @@ string_partition(PyStringObject *self, PyObject *sep_obj)
}
PyDoc_STRVAR
(
rpartition__doc__
,
"S.rpartition(sep) -> (
head, sep, tail
)
\n
\
"S.rpartition(sep) -> (
tail, sep, head
)
\n
\
\n
\
Searches for the separator sep in S, starting at the end of S, and returns
\n
\
the part before it, the separator itself, and the part after it. If the
\n
\
separator is not found, returns
S and two empty strings
."
);
separator is not found, returns
two empty strings and S
."
);
static
PyObject
*
string_rpartition
(
PyStringObject
*
self
,
PyObject
*
sep_obj
)
...
...
Objects/unicodeobject.c
View file @
185ac8a7
...
...
@@ -6712,11 +6712,11 @@ unicode_partition(PyUnicodeObject *self, PyObject *separator)
}
PyDoc_STRVAR
(
rpartition__doc__
,
"S.rpartition(sep) -> (
head, sep, tail
)
\n
\
"S.rpartition(sep) -> (
tail, sep, head
)
\n
\
\n
\
Searches for the separator sep in S, starting at the end of S, and returns
\n
\
the part before it, the separator itself, and the part after it. If the
\n
\
separator is not found, returns
S and two empty strings
."
);
separator is not found, returns
two empty strings and S
."
);
static
PyObject
*
unicode_rpartition
(
PyUnicodeObject
*
self
,
PyObject
*
separator
)
...
...
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