Before calling _PyType_Lookup() the type needs to be initialized.
This commit is contained in:
parent
0d94203cc1
commit
15d3d04547
@ -1383,6 +1383,11 @@ builtin_round(PyObject *self, PyObject *args, PyObject *kwds)
|
|||||||
kwlist, &number, &ndigits))
|
kwlist, &number, &ndigits))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (Py_Type(number)->tp_dict == NULL) {
|
||||||
|
if (PyType_Ready(Py_Type(number)) < 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (round_str == NULL) {
|
if (round_str == NULL) {
|
||||||
round_str = PyUnicode_FromString("__round__");
|
round_str = PyUnicode_FromString("__round__");
|
||||||
if (round_str == NULL)
|
if (round_str == NULL)
|
||||||
@ -1497,6 +1502,11 @@ builtin_trunc(PyObject *self, PyObject *number)
|
|||||||
static PyObject *trunc_str = NULL;
|
static PyObject *trunc_str = NULL;
|
||||||
PyObject *trunc;
|
PyObject *trunc;
|
||||||
|
|
||||||
|
if (Py_Type(number)->tp_dict == NULL) {
|
||||||
|
if (PyType_Ready(Py_Type(number)) < 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (trunc_str == NULL) {
|
if (trunc_str == NULL) {
|
||||||
trunc_str = PyUnicode_FromString("__trunc__");
|
trunc_str = PyUnicode_FromString("__trunc__");
|
||||||
if (trunc_str == NULL)
|
if (trunc_str == NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user