mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Guido has Spoken. Restore strop.replace()'s treatment of a 0 count as
meaning infinity -- but at least warn about it in the code! I pissed away a couple hours on this today, and don't wish the same on the next in line. Bugfix candidate.
This commit is contained in:
parent
da45d55a6e
commit
1ee77d9b71
2 changed files with 9 additions and 1 deletions
|
@ -77,7 +77,9 @@ test('replace', 'one!two!three!', 'one@two!three!', '!', '@', 1)
|
|||
test('replace', 'one!two!three!', 'one@two@three!', '!', '@', 2)
|
||||
test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3)
|
||||
test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4)
|
||||
test('replace', 'one!two!three!', 'one!two!three!', '!', '@', 0)
|
||||
# CAUTION: a replace count of 0 means infinity only to strop, not to the
|
||||
# string .replace() method or to the string.replace() function.
|
||||
test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0)
|
||||
test('replace', 'one!two!three!', 'one@two@three@', '!', '@')
|
||||
test('replace', 'one!two!three!', 'one!two!three!', 'x', '@')
|
||||
test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue