Nick Coghlan added the comment:

Review sent - very nice work on this Yury.

Highlights:

* I concur with Stefan that we should have a full PyCoroutineMethods struct at 
the C level, with a "tp_as_coroutine" pointer to that replacing the current 
tp_reserved slot

* I also concur with Stefan about adding a Coroutine ABC

* PyType_FromSpec (and typeslots.h) will need updating once we agree on a slot 
structure (with my recommendation being "define C level slots for all of the 
new PEP 492 methods")

* I found CO_COROUTINE/CO_NATIVE_COROUTINE confusing as a reader of the 
implementation, as they only told me how the objects were defined, rather than 
telling me why I should care. Based on what I gleaned of their intended purpose 
from reading the implementation, I suggest switching this to instead use 
CO_COROUTINE (set for all coroutines, regardless of how they were defined) and 
CO_ITERABLE_COROUTINE (set only for those coroutines that also support 
iteration), and adjusting the naming of other APIs accordingly.

* I found the names of the WITH_CLEANUP_ENTER and WITH_CLEANUP_EXIT bytecodes 
misleading, as they don't refer to the corresponding context management phases 
- they're both related to the "exit" phase. WITH_CLEANUP_START and 
WITH_CLEANUP_FINISH should be clearer for readers (both of the implementation 
and of the disassembled bytecode).

----------
nosy: +ncoghlan

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24017>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to