mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
It's ok for __hex__ or __oct__ to return unicode.
Don't insist that float('1'*10000) raises an exception.
This commit is contained in:
parent
a45ea5828e
commit
e1083734ec
2 changed files with 3 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue