mirror of
https://github.com/python/cpython.git
synced 2025-10-31 21:51:50 +00:00
SF 1193128: Let str.translate(None) be an identity transformation
This commit is contained in:
parent
5176180610
commit
4db5fe970c
6 changed files with 33 additions and 10 deletions
|
|
@ -487,7 +487,7 @@ def translate(s, table, deletions=""):
|
|||
deletions argument is not allowed for Unicode strings.
|
||||
|
||||
"""
|
||||
if deletions:
|
||||
if deletions or table is None:
|
||||
return s.translate(table, deletions)
|
||||
else:
|
||||
# Add s[:0] so that if s is Unicode and table is an 8-bit string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue