summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-06-28 21:35:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-06-28 21:35:31 (GMT)
commit5a6deb4caecca67a08ee0bf79a2df02f8c26b5f9 (patch)
treec82e6a629ef1a42ce997317d0693c7c48f03a52e
parent41a5750656da116a9e8f5f49e02f37d743d04a9e (diff)
downloadcpython-5a6deb4caecca67a08ee0bf79a2df02f8c26b5f9.zip
cpython-5a6deb4caecca67a08ee0bf79a2df02f8c26b5f9.tar.gz
cpython-5a6deb4caecca67a08ee0bf79a2df02f8c26b5f9.tar.bz2
remove string.maketrans
-rw-r--r--Lib/string.py22
-rw-r--r--Misc/NEWS2
2 files changed, 2 insertions, 22 deletions
diff --git a/Lib/string.py b/Lib/string.py
index e071a2d..4599997 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -40,28 +40,6 @@ def capwords(s, sep=None):
return (sep or ' ').join([x.capitalize() for x in s.split(sep)])
-# Construct a translation map for bytes.translate
-def maketrans(frm: bytes, to: bytes) -> bytes:
- """maketrans(frm, to) -> bytes
-
- Return a translation table (a bytes object of length 256)
- suitable for use in bytes.translate where each byte in frm is
- mapped to the byte at the same position in to.
- The strings frm and to must be of the same length.
- """
- import warnings
- warnings.warn("string.maketrans is deprecated, use bytes.maketrans instead",
- DeprecationWarning, 2)
- if len(frm) != len(to):
- raise ValueError("maketrans arguments must have same length")
- if not (isinstance(frm, bytes) and isinstance(to, bytes)):
- raise TypeError("maketrans arguments must be bytes objects")
- L = bytearray(range(256))
- for i, c in enumerate(frm):
- L[c] = to[i]
- return bytes(L)
-
-
####################################################################
import re as _re
diff --git a/Misc/NEWS b/Misc/NEWS
index 91a47da..a182ca5 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,6 +17,8 @@ Core and Builtins
Library
-------
+- The deprecated function string.maketrans has been removed.
+
Build
-----