diff options
author | Georg Brandl <georg@python.org> | 2009-04-12 15:51:51 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-12 15:51:51 (GMT) |
commit | abc387747dc573e05a4b31387797a0272062b2ef (patch) | |
tree | c12c0a0e45cb06edb87798a7831b1c8f79033015 /Objects/bytearrayobject.c | |
parent | 78532baeabc4234e3894c775f2bb7e0a21c12e0e (diff) | |
download | cpython-abc387747dc573e05a4b31387797a0272062b2ef.zip cpython-abc387747dc573e05a4b31387797a0272062b2ef.tar.gz cpython-abc387747dc573e05a4b31387797a0272062b2ef.tar.bz2 |
Add bytes/bytearray.maketrans() to mirror str.maketrans(), and deprecate
string.maketrans() which actually works on bytes. (Also closes #5675.)
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index bc8f39e..ca597a2 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -1451,6 +1451,13 @@ done: } +static PyObject * +bytes_maketrans(PyObject *null, PyObject *args) +{ + return _Py_bytes_maketrans(args); +} + + #define FORWARD 1 #define REVERSE -1 @@ -3131,6 +3138,8 @@ bytes_methods[] = { {"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__}, {"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__}, {"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, lstrip__doc__}, + {"maketrans", (PyCFunction)bytes_maketrans, METH_VARARGS|METH_STATIC, + _Py_maketrans__doc__}, {"partition", (PyCFunction)bytes_partition, METH_O, partition__doc__}, {"pop", (PyCFunction)bytes_pop, METH_VARARGS, pop__doc__}, {"remove", (PyCFunction)bytes_remove, METH_O, remove__doc__}, |