diff Python/bltinmodule.c @ 42760:e3e06b389406

Before calling _PyType_Lookup() the type needs to be initialized.
author Guido van Rossum <guido@python.org>
date Fri, 24 Aug 2007 02:02:45 +0000
parents 077fe7860cc9
children 5355337709e1
line wrap: on
line diff
--- a/Python/bltinmodule.c	Fri Aug 24 00:10:00 2007 +0000
+++ b/Python/bltinmodule.c	Fri Aug 24 02:02:45 2007 +0000
@@ -1383,6 +1383,11 @@
                 kwlist, &number, &ndigits))
                 return NULL;
 
+	if (Py_Type(number)->tp_dict == NULL) {
+		if (PyType_Ready(Py_Type(number)) < 0)
+			return NULL;
+	}
+
 	if (round_str == NULL) {
 		round_str = PyUnicode_FromString("__round__");
 		if (round_str == NULL)
@@ -1497,6 +1502,11 @@
 	static PyObject *trunc_str = NULL;
 	PyObject *trunc;
 
+	if (Py_Type(number)->tp_dict == NULL) {
+		if (PyType_Ready(Py_Type(number)) < 0)
+			return NULL;
+	}
+
 	if (trunc_str == NULL) {
 		trunc_str = PyUnicode_FromString("__trunc__");
 		if (trunc_str == NULL)