| return 1; | ||
| } | ||
|
|
||
|
|
| return NULL; | ||
| } | ||
| k = PyTuple_GET_SIZE(base->tp_mro); | ||
| result = PyTuple_New(k + 1); |
There was a problem hiding this comment.
Shouldn't the result be a tuple?
There was a problem hiding this comment.
You mean a list? The caller calls PySequence_Tuple on the result, so it's faster if we create a tuple upfront.
| return mro_implementation(self); | ||
| PyObject *seq; | ||
| seq = mro_implementation(self); | ||
| if (seq != NULL && PyTuple_CheckExact(seq)) { |
There was a problem hiding this comment.
I would write !PyList_Check().
| PyObject *seq; | ||
| seq = mro_implementation(self); | ||
| if (seq != NULL && PyTuple_CheckExact(seq)) { | ||
| PyObject *lst = PySequence_List(seq); |
There was a problem hiding this comment.
This may look clearer with
Py_SETREF(seq, PySequence_List(seq));and a single return.
There was a problem hiding this comment.
I have to get used to it :-)
|
Thanks for the review @serhiy-storchaka ! |
https://bugs.python.org/issue32379