Getting a code obj's function?

Bjoern Giesler un4e at
Fri Dec 15 10:28:03 CET 2000


another inane question... there a standard way to get the function object that a code object is
associated with? On exception, I only get the code object from the

If there is no standard way, could somebody please comment on the following:
I've modified my Python interpreter so that a code object has one more
member, co_func. This gets set to None initially, and PyFunc_New() sets it
to the new function object that is created. What are the potential problems
with this approach, if any? I see all kinds of memory leaks / double frees
coming, but haven't really enough understanding of Python to know what might
happen. My assumption was that a code object is assigned to a maximum of
exactly one function. Is this correct?


More information about the Python-list mailing list