From: Brett Cannon Date: Thu, 8 Jun 2006 16:23:04 +0000 (+0000) Subject: Make binascii.hexlify() use s# for its arguments instead of t# to actually X-Git-Tag: v2.5b1~190 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ee7d01c059f799c0f52ffe94811507bccc688a2;p=python Make binascii.hexlify() use s# for its arguments instead of t# to actually match its documentation stating it accepts any read-only buffer. --- diff --git a/Misc/NEWS b/Misc/NEWS index fea1a6a63d..6c1fddbc17 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -75,6 +75,9 @@ Core and builtins Extension Modules ----------------- +- Change binascii.hexlify to accept a read-only buffer instead of only a char + buffer and actually follow its documentation. + - Fixed a potentially invalid memory access of CJKCodecs' shift-jis decoder. - Patch #1478788 (modified version): The functional extension module has diff --git a/Modules/binascii.c b/Modules/binascii.c index 71a962452e..3b2c8b254c 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -909,7 +909,7 @@ binascii_hexlify(PyObject *self, PyObject *args) char* retbuf; Py_ssize_t i, j; - if (!PyArg_ParseTuple(args, "t#:b2a_hex", &argbuf, &arglen)) + if (!PyArg_ParseTuple(args, "s#:b2a_hex", &argbuf, &arglen)) return NULL; retval = PyString_FromStringAndSize(NULL, arglen*2);