Le 11/06/2014 10:28, Victor Stinner a écrit :
Hi,
I'm working on asyncio and it's difficult to debug code because
@asyncio.coroutine decorator removes the name of the function if the
function is not a generator (if it doesn't use yield from).
I propose to add new gi_name and gi_qualname fields to the C structure
PyGenObject, add a new __qualname__ (= gi_qualname) attribute to the
Python API of generator, and change how the default value of __name__
(= gi_name) of generators.
Instead of getting the name from the code object, I propose to get the
name from the function (if the generator was created from a function).
So if the function name was modified, you get the new name instead of
getting the name from the code object (as done in Python 3.4).
I also propose to display the qualified name in repr(generator)
instead of the name.
All these changes should make my life easier to debug asyncio, but it
should help any project using generators.
Issues describing the problem, I attached a patch implementing my ideas:
http://bugs.python.org/issue21205
Would you be ok with these (minor) incompatible changes?
+1 from me.
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com