diff options
| author | Eli Bendersky <eliben@gmail.com> | 2011-07-29 07:05:08 +0300 |
|---|---|---|
| committer | Eli Bendersky <eliben@gmail.com> | 2011-07-29 07:05:08 +0300 |
| commit | 9efd2ec8bde1aa42298194474edd5b1c0bdcffbf (patch) | |
| tree | c09b5a942562590ab95b37a0c299079a33fe4219 /Python/getargs.c | |
| parent | 16772357349213ded4468acfcee445147193d2f4 (diff) | |
| download | cpython-9efd2ec8bde1aa42298194474edd5b1c0bdcffbf.tar.gz | |
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
Diffstat (limited to 'Python/getargs.c')
| -rw-r--r-- | Python/getargs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index 4b57153b88..c3da368604 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -828,6 +828,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, 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; |
