[issue33261] inspect.isgeneratorfunction fails on hand-created methods

Terry J. Reedy report at bugs.python.org
Sat Apr 14 15:07:52 EDT 2018


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I would like python_coded_callable.__code__ to be the code object executed when python_coded_callable is called, just as expected by the isxyz author(s).  It has to exist somewhere.  Methods m and m3 both return 42 when called, and both have the same code object.

>>> m3.__code__
<code object __call__ at 0x000001431C797E40, file "F:\Python\a\tem2.py", line 3>
>>> m3.__func__.__code__
<code object __call__ at 0x000001431C797E40, file "F:\Python\a\tem2.py", line 3>
>>> m.__func__.__call__.__code__
<code object __call__ at 0x000001431C797E40, file "F:\Python\a\tem2.py", line 3>

The fact that m requires an additional level of indirection is an implementation detail that I don't think necessarily has to involve users.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33261>
_______________________________________


More information about the Python-bugs-list mailing list