Message338630
We use finally blocks in ``__aiter__`` like this:
```
class AsyncFinallyIterator:
def __aiter__(self):
for i in range(10):
try:
yield i
finally:
print('FINALLY')
```
Attached is a test for both iterators and async iterators.
The tests pass on Python 3.6, but only the non-async iterator test pass under Python 3.7.
Thanks for your attention!
This worked perfectly well in Python 3.6, but stopped working in Python 3.7.
I also verified that Iterator supports the same construct (and this works in both Python 3.6 and 3.7):
```
class FinallyIterator:
def __iter__(self):
for i in range(10):
try:
yield i
finally:
print('FINALLY')
``` |
|
Date |
User |
Action |
Args |
2019-03-23 00:15:07 | asksol | set | recipients:
+ asksol |
2019-03-23 00:15:07 | asksol | set | messageid: <1553300107.21.0.160175909039.issue36403@roundup.psfhosted.org> |
2019-03-23 00:15:07 | asksol | link | issue36403 messages |
2019-03-23 00:15:06 | asksol | create | |
|