Re: [Python-Dev] asyncio: how to interrupt an async def w/ finally: ( e.g. Condition.wait() )

2015-12-19 Thread Matthias Urlichs
On 20.12.2015 01:26, Kevin Conway wrote: > async def coroutine(): > try: > await Awaitable() > await Awaitable() > finally: > print('finally') Try adding another "await Awaitable()" after the "finally:". I have to take back my "doesn't print an error" comment, howev

Re: [Python-Dev] asyncio: how to interrupt an async def w/ finally: ( e.g. Condition.wait() )

2015-12-19 Thread Guido van Rossum
On Sat, Dec 19, 2015 at 1:40 PM, Matthias Urlichs wrote: > On 19.12.2015 20:25, Guido van Rossum wrote: > > Perhaps you can add a check for a simple boolean 'stop' flag to your > > condition check, and when you want to stop the loop you set that flag > > and then call notify() on the condition. T

Re: [Python-Dev] asyncio: how to interrupt an async def w/ finally: ( e.g. Condition.wait() )

2015-12-19 Thread Kevin Conway
> An async procedure call whose refcount reaches zero without completing simply goes away; finally: blocks are *not* called and there is *no* warning. I believe OP is looking at these two scenarios: def generator(): try: yield None yield None finally: print('finall

Re: [Python-Dev] asyncio: how to interrupt an async def w/ finally: ( e.g. Condition.wait() )

2015-12-19 Thread Gustavo Carneiro
I tried to reproduce the problem you describe, but failed. Here's my test program (forgive the awful tab indentation, long story): -- import asyncio async def foo(): print("resource acquire") try: await asyncio.sleep(100) finally: print("resource release") async def main(): task =

Re: [Python-Dev] asyncio: how to interrupt an async def w/ finally: ( e.g. Condition.wait() )

2015-12-19 Thread Matthias Urlichs
On 19.12.2015 20:25, Guido van Rossum wrote: > Perhaps you can add a check for a simple boolean 'stop' flag to your > condition check, and when you want to stop the loop you set that flag > and then call notify() on the condition. Then you can follow the > standard condition variable protocol inste

Re: [Python-Dev] asyncio: how to interrupt an async def w/ finally: ( e.g. Condition.wait() )

2015-12-19 Thread Guido van Rossum
Perhaps you can add a check for a simple boolean 'stop' flag to your condition check, and when you want to stop the loop you set that flag and then call notify() on the condition. Then you can follow the standard condition variable protocol instead of all this nonsense. :-) class Foo: async de

Re: [Python-Dev] Typo in PEP-0423

2015-12-19 Thread A.M. Kuchling
On Sat, Dec 19, 2015 at 08:55:26PM +1000, Nick Coghlan wrote: > Even once the new docs are in place, getting them to the top of search > of results ahead of archived material that may be years out of date is > likely to still be a challenge - for example, even considering just > the legacy distutil

Re: [Python-Dev] [Webmaster] Python keeps installing as 32 bit

2015-12-19 Thread Terry Reedy
On 12/18/2015 4:34 PM, Mullins, Robb wrote: Please remove these posts/liservs, etc. if possible, or strip my contact info/name/phone/email off the posts please. I’m getting calls from people trying to help with my Python install issue. http://code.activestate.com/lists/python-dev/138936/ htt

Re: [Python-Dev] Typo in PEP-0423

2015-12-19 Thread Terry Reedy
On 12/19/2015 5:55 AM, Nick Coghlan wrote: Even once the new docs are in place, getting them to the top of search of results ahead of archived material that may be years out of date is likely to still be a challenge - for example, even considering just the legacy distutils docs, the "3.1" and "2

[Python-Dev] asyncio: how to interrupt an async def w/ finally: ( e.g. Condition.wait() )

2015-12-19 Thread Matthias Urlichs
The following code has a problem: the generator returned by .wait() has a finally: section. When self.stopped is set, it still needs to run. As it is asynchronous (it needs to re-acquire the lock), I need to come up with a reliable way to wait for it. If I don't, .release() will throw an excepti

Re: [Python-Dev] Typo in PEP-0423

2015-12-19 Thread Guido van Rossum
Maybe we need to find a S.E.O. expert. I betcha some are lurking on this list. On Sat, Dec 19, 2015 at 2:55 AM, Nick Coghlan wrote: > On 19 December 2015 at 03:44, Guido van Rossum wrote: > > On Fri, Dec 18, 2015 at 9:34 AM, Tim Legrand > > > wrote: > >> > >> Well, this looks like a rhetorical

Re: [Python-Dev] [Webmaster] Python keeps installing as 32 bit

2015-12-19 Thread Mullins, Robb
Hi, Please remove these posts/liservs, etc. if possible, or strip my contact info/name/phone/email off the posts please. I’m getting calls from people trying to help with my Python install issue. http://code.activestate.com/lists/python-dev/138936/ http://blog.gmane.org/gmane.comp.python.dev

Re: [Python-Dev] Typo in PEP-0423

2015-12-19 Thread Nick Coghlan
On 19 December 2015 at 03:44, Guido van Rossum wrote: > On Fri, Dec 18, 2015 at 9:34 AM, Tim Legrand > wrote: >> >> Well, this looks like a rhetorical question :) > > It wasn't, I was hoping you'd be quicker at picking one than me (I don't > publish packages on PyPI much myself so the docs all lo