Author: Richard Plangger <planri...@gmail.com> Branch: py3.5-async Changeset: r85904:000728f0465a Date: 2016-07-29 15:31 +0200 http://bitbucket.org/pypy/pypy/changeset/000728f0465a/
Log: add __await__ method to Coroutine typedef and redirect it to descr__await__ diff --git a/pypy/interpreter/generator.py b/pypy/interpreter/generator.py --- a/pypy/interpreter/generator.py +++ b/pypy/interpreter/generator.py @@ -319,6 +319,12 @@ self.running = False if self.pycode.co_flags & CO_YIELD_INSIDE_TRY: self.register_finalizer(self.space) + + def descr__await__(self, space): + # implement this function: + # https://github.com/python/cpython/blob/3.5/Objects/genobject.c#L786 + # you need a new CoroutineWrapper object + CoroutineWrapperType + pass def descr__reduce__(self, space): from pypy.interpreter.mixedmodule import MixedModule diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py --- a/pypy/interpreter/typedef.py +++ b/pypy/interpreter/typedef.py @@ -811,6 +811,8 @@ descrmismatch='close'), __iter__ = interp2app(Coroutine.descr__iter__, descrmismatch='__iter__'), + __await__ = interp2app(Coroutine.descr__await__, + descrmismatch='__await__'), gi_running = interp_attrproperty('running', cls=Coroutine), gi_frame = GetSetProperty(Coroutine.descr_gi_frame), gi_code = GetSetProperty(Coroutine.descr_gi_code), _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit