SF 1193128: Let str.translate(None) be an identity transformation

This commit is contained in:
Raymond Hettinger 2007-04-12 04:10:00 +00:00
parent 5176180610
commit 4db5fe970c
6 changed files with 33 additions and 10 deletions

View file

@ -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,