diff Python/bltinmodule.c @ 41728:6ea93700d779

It's ok for __hex__ or __oct__ to return unicode. Don't insist that float('1'*10000) raises an exception.
author Guido van Rossum <guido@python.org>
date Tue, 15 May 2007 21:32:59 +0000
parents 23a8b3dfbe95
children f9949b63eab3
line wrap: on
line diff
--- a/Python/bltinmodule.c	Tue May 15 21:25:12 2007 +0000
+++ b/Python/bltinmodule.c	Tue May 15 21:32:59 2007 +0000
@@ -1230,7 +1230,7 @@
 		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 @@
 		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);