[Python-Dev] Caching function pointers in type objects (original) (raw)

Benjamin Peterson benjamin at python.org
Wed Mar 3 03:57:31 CET 2010


2010/3/2 Daniel Stutzbach <daniel at stutzbachenterprises.com>:

In CPython, is it safe to cache function pointers that are in type objects?

For example, if I know that sometype->tprichcompare is non-NULL, and I call it (which may execute arbitrary user code), can I assume that sometype->tprichcompare is still non-NULL?

Not unless it's builtin. Somebody could have deleted the rich comparison methods.

-- Regards, Benjamin



More information about the Python-Dev mailing list