aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/codecs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index f9f23005deb..4e47ff93a36 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -516,7 +516,7 @@ PyObject * _PyCodec_LookupTextEncoding(const char *encoding,
* attribute.
*/
if (!PyTuple_CheckExact(codec)) {
- if (_PyObject_LookupAttr(codec, &_Py_ID(_is_text_encoding), &attr) < 0) {
+ if (PyObject_GetOptionalAttr(codec, &_Py_ID(_is_text_encoding), &attr) < 0) {
Py_DECREF(codec);
return NULL;
}