
The tp_clear field of PyTypeObject has type inquiry. It is a pointer to a function that takes PyObject * and return int. typedef int (*inquiry)(PyObject *); I'm interesting what the result of this function means. In what cases it can return non-zero, and can it set an exception? Currently tp_clear() is called in a single place, and its result is ignored. All tp_clear implementations in the stdlib always return 0.

On 2018-05-28, Serhiy Storchaka wrote:
I'm interesting what the result of this function means. In what cases it can return non-zero, and can it set an exception?
My memory is fuzzy (nearly 20 years since I wrote that code). My best guess is that I thought a return value might be useful somehow. As you have noticed, the return type probably should have been void. If you want to see one of the first implementations of the Python GC, I still have a patch: http://python.ca/nas/python/gc/gc-cycle-152.diff Regards, Neil
participants (2)
-
Neil Schemenauer
-
Serhiy Storchaka