[issue28910] Async generator does not raise RuntimeError if finalizer not set

2016-12-08 Thread Yury Selivanov

Yury Selivanov added the comment:

fix: 
https://github.com/python/peps/commit/3e23210fe3aebefb269436e16246f63e1f006291

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28910] Async generator does not raise RuntimeError if finalizer not set

2016-12-08 Thread Yury Selivanov

Yury Selivanov added the comment:

> I'm not sure if this is a bug, or this is intentional and the finalizer 
> mechanism should be optional. If it is the latter should PEP525 get updated?

This is intentional, PEP 525 is slightly outdated.  I'll update it right now.  
Thanks for reporting this!

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28910] Async generator does not raise RuntimeError if finalizer not set

2016-12-08 Thread Eric Appelt

New submission from Eric Appelt:

While testing my understanding in order to document PEP525 asynchronous 
generators in the Language Reference (issue 28091) I noticed that the 
implemented behavior deviates from PEP525, specifically the PEP states that:

"When an asynchronous generator is iterated for the first time, it stores a 
reference to the current finalizer. If there is none, a RuntimeError is raised. 
This provides a strong guarantee that every asynchronous generator object will 
always have a finalizer installed by the correct event loop."

I created an asynchronous generator to try to run calling __anext__ 
interactively without an event loop to check the behavior, and was surprised 
when I didn't get a RuntimeError even though I had not called 
sys.set_asyncgen_hooks() to set a finalizer function.

I looked at the function async_gen_init_hooks defined in Objects/genobject.c 
and it appears that if the thread state async_gen_finalizer is NULL, then it 
just returns zero and allows the calling function to continue.

I'm not sure if this is a bug, or this is intentional and the finalizer 
mechanism should be optional. If it is the latter should PEP525 get updated?

--
components: Interpreter Core
messages: 282737
nosy: Eric Appelt, yselivanov
priority: normal
severity: normal
status: open
title: Async generator does not raise RuntimeError if finalizer not set
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com