[issue24325] Speedup types.coroutine()

Stefan Behnel report at bugs.python.org
Fri Jul 3 08:23:22 CEST 2015


Stefan Behnel added the comment:

This is not purely about speeding up the code. It's also about avoiding to replace the code object of a function, which is essentially a big and clumsy hack only to achieve setting a flag. Some tools, namely line_profiler, use the current code object as a dict key for state keeping. Replacing the reference in "__code__" might confuse them if they happened to catch a reference before.

That's why I asked for applying at least the simple patch that sets the flag with a C level helper function. But I'd be ok with applying the latest patch as it is. The non-flag-setting parts are simple and a straight forward translation of the current Python code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24325>
_______________________________________


More information about the Python-bugs-list mailing list