Mercurial > cpython-lru_cache-weakref
diff Python/getargs.c @ 71543:536fccc75f5a
Issue #12380: PyArg_ParseTuple now accepts a bytearray for the 'c' format.
As a side effect, this now allows the rjust, ljust and center methods of
bytes and bytearray to accept a bytearray argument.
Patch by Petri Lehtinen
| author | Eli Bendersky <eliben@gmail.com> |
|---|---|
| date | Fri, 29 Jul 2011 07:05:08 +0300 |
| parents | 4c2135930882 |
| children | 8beaa9a37387 |
line wrap: on
line diff
--- a/Python/getargs.c Thu Jul 28 09:55:13 2011 -0700 +++ b/Python/getargs.c Fri Jul 29 07:05:08 2011 +0300 @@ -828,6 +828,8 @@ char *p = va_arg(*p_va, char *); if (PyBytes_Check(arg) && PyBytes_Size(arg) == 1) *p = PyBytes_AS_STRING(arg)[0]; + else if (PyByteArray_Check(arg) && PyByteArray_Size(arg) == 1) + *p = PyByteArray_AS_STRING(arg)[0]; else return converterr("a byte string of length 1", arg, msgbuf, bufsize); break;
