[Python-3000-checkins] r57368 - python/branches/py3k/Python/bltinmodule.c

guido.van.rossum python-3000-checkins at python.org
Fri Aug 24 04:02:46 CEST 2007


Author: guido.van.rossum
Date: Fri Aug 24 04:02:45 2007
New Revision: 57368

Modified:
   python/branches/py3k/Python/bltinmodule.c
Log:
Before calling _PyType_Lookup() the type needs to be initialized.


Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c	(original)
+++ python/branches/py3k/Python/bltinmodule.c	Fri Aug 24 04:02:45 2007
@@ -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)


More information about the Python-3000-checkins mailing list