diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-30 17:48:54 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-30 17:48:54 +0300 |
commit | e90982111ae1accc2a2ecaae94650a1d16a772ff (patch) | |
tree | 960c19c6de6a13c3aa3f1388ffe2898c112c61d0 /Python/codecs.c | |
parent | f49c42324fb85596bcfaaba236ecd6e22138be72 (diff) | |
parent | ac5569b1fa483c50edca82bab1ab0a8a927ba86a (diff) | |
download | cpython-git-e90982111ae1accc2a2ecaae94650a1d16a772ff.tar.gz |
Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
Diffstat (limited to 'Python/codecs.c')
-rw-r--r-- | Python/codecs.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Python/codecs.c b/Python/codecs.c index 38b0c2c33d..596bd80818 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -550,12 +550,13 @@ PyObject * _PyCodec_LookupTextEncoding(const char *encoding, } else { is_text_codec = PyObject_IsTrue(attr); Py_DECREF(attr); - if (!is_text_codec) { + if (is_text_codec <= 0) { Py_DECREF(codec); - PyErr_Format(PyExc_LookupError, - "'%.400s' is not a text encoding; " - "use %s to handle arbitrary codecs", - encoding, alternate_command); + if (!is_text_codec) + PyErr_Format(PyExc_LookupError, + "'%.400s' is not a text encoding; " + "use %s to handle arbitrary codecs", + encoding, alternate_command); return NULL; } } |