summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-24 02:02:45 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-24 02:02:45 (GMT)
commit15d3d045470dbd829bdc821d3d7f1efd35436538 (patch)
treeb553ecf0e05874822d392bb35c3b6b49dc561738 /Python
parent0d94203cc1f2c2f07f79d45f7c6ee0e90bc95eca (diff)
downloadcpython-15d3d045470dbd829bdc821d3d7f1efd35436538.zip
cpython-15d3d045470dbd829bdc821d3d7f1efd35436538.tar.gz
cpython-15d3d045470dbd829bdc821d3d7f1efd35436538.tar.bz2
Before calling _PyType_Lookup() the type needs to be initialized.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 9bbf64b..d087e9c 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1383,6 +1383,11 @@ builtin_round(PyObject *self, PyObject *args, PyObject *kwds)
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 @@ builtin_trunc(PyObject *self, PyObject *number)
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)