summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index aa0d0df..064b92a 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1230,7 +1230,7 @@ builtin_hex(PyObject *self, PyObject *v)
return NULL;
}
res = (*nb->nb_hex)(v);
- if (res && !PyString_Check(res)) {
+ if (res && !PyString_Check(res) && !PyUnicode_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__hex__ returned non-string (type %.200s)",
res->ob_type->tp_name);
@@ -1430,7 +1430,7 @@ builtin_oct(PyObject *self, PyObject *v)
return NULL;
}
res = (*nb->nb_oct)(v);
- if (res && !PyString_Check(res)) {
+ if (res && !PyString_Check(res) && !PyUnicode_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__oct__ returned non-string (type %.200s)",
res->ob_type->tp_name);