diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-23 12:12:25 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-23 12:12:25 (GMT) |
commit | f8d7d41507d8c0855b58c9be14011381d03c5cde (patch) | |
tree | 1a38be5e64aaf4c64a7581f209548818926cdb0f /Objects/exceptions.c | |
parent | 8c9331057d0f5c75cd3e73f3f85fe237da0f9ed1 (diff) | |
download | cpython-f8d7d41507d8c0855b58c9be14011381d03c5cde.zip cpython-f8d7d41507d8c0855b58c9be14011381d03c5cde.tar.gz cpython-f8d7d41507d8c0855b58c9be14011381d03c5cde.tar.bz2 |
Issue #28511: Use the "U" format instead of "O!" in PyArg_Parse*.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r-- | Objects/exceptions.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index bc0264a..57a786c 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -1820,18 +1820,10 @@ UnicodeEncodeError_init(PyObject *self, PyObject *args, PyObject *kwds) Py_CLEAR(err->object); Py_CLEAR(err->reason); - if (!PyArg_ParseTuple(args, "O!O!nnO!", - &PyUnicode_Type, &err->encoding, - &PyUnicode_Type, &err->object, - &err->start, - &err->end, - &PyUnicode_Type, &err->reason)) { - err->encoding = err->object = err->reason = NULL; - return -1; - } - - if (PyUnicode_READY(err->object) < -1) { - err->encoding = NULL; + if (!PyArg_ParseTuple(args, "UUnnU", + &err->encoding, &err->object, + &err->start, &err->end, &err->reason)) { + err->encoding = err->object = err->reason = NULL; return -1; } @@ -1935,12 +1927,9 @@ UnicodeDecodeError_init(PyObject *self, PyObject *args, PyObject *kwds) Py_CLEAR(ude->object); Py_CLEAR(ude->reason); - if (!PyArg_ParseTuple(args, "O!OnnO!", - &PyUnicode_Type, &ude->encoding, - &ude->object, - &ude->start, - &ude->end, - &PyUnicode_Type, &ude->reason)) { + if (!PyArg_ParseTuple(args, "UOnnU", + &ude->encoding, &ude->object, + &ude->start, &ude->end, &ude->reason)) { ude->encoding = ude->object = ude->reason = NULL; return -1; } @@ -2050,11 +2039,9 @@ UnicodeTranslateError_init(PyUnicodeErrorObject *self, PyObject *args, Py_CLEAR(self->object); Py_CLEAR(self->reason); - if (!PyArg_ParseTuple(args, "O!nnO!", - &PyUnicode_Type, &self->object, - &self->start, - &self->end, - &PyUnicode_Type, &self->reason)) { + if (!PyArg_ParseTuple(args, "UnnU", + &self->object, + &self->start, &self->end, &self->reason)) { self->object = self->reason = NULL; return -1; } |