summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/tag.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/tag.cc b/python/tag.cc
index 9f175cc4..50786cee 100644
--- a/python/tag.cc
+++ b/python/tag.cc
@@ -474,6 +474,8 @@ static PyObject *TagFileNew(PyTypeObject *type,PyObject *Args,PyObject *kwds)
#if PY_MAJOR_VERSION >= 3
if (fileno != -1) {
New->Encoding = PyObject_GetAttr(File, PyUnicode_FromString("encoding"));
+ if (!New->Encoding)
+ PyErr_Clear();
if (New->Encoding && !PyUnicode_Check(New->Encoding))
New->Encoding = 0;
} else