In short, some parts are hard to read and hard to maintain, despite improvable:
PyObject*
Everywhere (some shall be explicitly marked as PyXxObject*
like PyListObject*
, and even being marked as a subclass like Py_exc_state.memerrors_freelist as PyBaseExceptionObject, still not PyMemoryErrorObject)
data structure is embeded in struct (e.g. PyInterpreterState.threads (and PyRuntimeState.interpreters, comments say there is a linkeklist within, but it’s hard to tell which is the pointer to the next (prev, next defined in PyThreadState)), (shall impl a seperated stuct PyDoublyLinkedList) (e.g. _Py_exc_state.memerrors_freelist uses .dict as next
)
mixed bool, int, char (some int shall be bool, and some shall be enum (0→none, 1→successful, -1→error))
dup code snippets, scattered everywhere. (some code snippets are dup many times, even in different modules, resulting in some old code logic forgetten to be updated; or behavior differs)