Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-14 Thread Guido van Rossum
A good plan. I think this could be added to 3.5 still? It's a pretty minor adjustment to the PEP 492 machinery, really. On Sat, Jun 13, 2015 at 6:16 PM, Nick Coghlan ncogh...@gmail.com wrote: On 14 Jun 2015 10:01, Ben Leslie be...@benno.id.au wrote: If this seems like a good approach I'll

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-14 Thread Mark Lawrence
On 14/06/2015 11:50, Ben Leslie wrote: Per Nick's advice I've created enhancement proposal 245340 with an attached patch. http://bugs.python.org/issue24450 as opposed to http://bugs.python.org/issue24450#msg245340 :) -- My fellow Pythonistas, ask not what our language can do for you, ask

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-14 Thread Nick Coghlan
On 14 Jun 2015 19:17, Guido van Rossum gu...@python.org wrote: A good plan. I think this could be added to 3.5 still? It's a pretty minor adjustment to the PEP 492 machinery, really. Good point - as per Ben's original post, the lack of it makes it quite hard to get a clear picture of the system

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-14 Thread Ben Leslie
Per Nick's advice I've created enhancement proposal 245340 with an attached patch. On 14 June 2015 at 19:16, Guido van Rossum gu...@python.org wrote: A good plan. I think this could be added to 3.5 still? It's a pretty minor adjustment to the PEP 492 machinery, really. On Sat, Jun 13, 2015 at

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Nick Coghlan
On 14 Jun 2015 03:35, Guido van Rossum gu...@python.org wrote: On Sat, Jun 13, 2015 at 9:21 AM, Nick Coghlan ncogh...@gmail.com wrote: From a learnability perspective, there's also nothing about an f_stack attribute that says you can use this to find out where a generator or coroutine has

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Nick Coghlan
On 14 Jun 2015 10:01, Ben Leslie be...@benno.id.au wrote: If this seems like a good approach I'll try and work it in to a suitable patch for contribution. I think it's a good approach, and worth opening an enhancement issue for. I expect any patch would need some adjustments after Yury has

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Greg Ewing
Nick Coghlan wrote: I wonder if in 3.6 it might be possible to *add* some bookkeeping to await and yield from expressions that provides external visibility into the underlying iterable or coroutine that the generator-iterator or coroutine has delegated flow control to. In my original

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Ben Leslie
On 14 June 2015 at 09:20, Greg Ewing greg.ew...@canterbury.ac.nz wrote: Nick Coghlan wrote: I wonder if in 3.6 it might be possible to *add* some bookkeeping to await and yield from expressions that provides external visibility into the underlying iterable or coroutine that the

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Ben Leslie
On 13 June 2015 at 19:03, Guido van Rossum gu...@python.org wrote: On Sat, Jun 13, 2015 at 12:22 AM, Nick Coghlan ncogh...@gmail.com wrote: On 13 June 2015 at 04:13, Guido van Rossum gu...@python.org wrote: IOW I don't think that the problem here is that you haven't sufficiently motivated

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Guido van Rossum
On Sat, Jun 13, 2015 at 12:22 AM, Nick Coghlan ncogh...@gmail.com wrote: On 13 June 2015 at 04:13, Guido van Rossum gu...@python.org wrote: IOW I don't think that the problem here is that you haven't sufficiently motivated your use case -- you are asking for information that just isn't

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Ben Leslie
On 13 June 2015 at 17:22, Nick Coghlan ncogh...@gmail.com wrote: On 13 June 2015 at 04:13, Guido van Rossum gu...@python.org wrote: IOW I don't think that the problem here is that you haven't sufficiently motivated your use case -- you are asking for information that just isn't available.

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread jaivish kothari
Hi , I had a Question,i hope i'll find the solution here. Say i have a Queue. h = Queue.Queue(maxsize=0) h.put(1) h.put(2) h.empty() False h.join() h.empty() False h.get() 1 h.get() 2 h.get() Blocked... My Question is : In a single threaded environment why does

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Nick Coghlan
On 13 June 2015 at 04:13, Guido van Rossum gu...@python.org wrote: IOW I don't think that the problem here is that you haven't sufficiently motivated your use case -- you are asking for information that just isn't available. (Which is actually where you started the thread -- you can get to the

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Nick Coghlan
On 13 June 2015 at 20:25, Ben Leslie be...@benno.id.au wrote: Is there any reason an f_stack attribute is not exposed for frames? Many of the other PyFrameObject values are exposed. I'm guessing that there probably aren't too many places where you can get hold of a frame that doesn't have an

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread Guido van Rossum
On Sat, Jun 13, 2015 at 9:21 AM, Nick Coghlan ncogh...@gmail.com wrote: On 13 June 2015 at 20:25, Ben Leslie be...@benno.id.au wrote: Is there any reason an f_stack attribute is not exposed for frames? Many of the other PyFrameObject values are exposed. I'm guessing that there probably

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-13 Thread MRAB
On 2015-06-13 11:38, jaivish kothari wrote: Hi , I had a Question,i hope i'll find the solution here. Say i have a Queue. h = Queue.Queue(maxsize=0) h.put(1) h.put(2) h.empty() False h.join() h.empty() False h.get() 1 h.get() 2 h.get() Blocked... My

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-12 Thread Guido van Rossum
On Thu, Jun 11, 2015 at 11:38 PM, Ben Leslie be...@benno.id.au wrote: On 2 June 2015 at 14:39, Yury Selivanov yselivanov...@gmail.com wrote: Hi Ben, On 2015-05-31 8:35 AM, Ben Leslie wrote: Hi Yury, I'm just starting my exploration into using async/await; all my 'real-world'

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-12 Thread Ben Leslie
On 2 June 2015 at 14:39, Yury Selivanov yselivanov...@gmail.com wrote: Hi Ben, On 2015-05-31 8:35 AM, Ben Leslie wrote: Hi Yury, I'm just starting my exploration into using async/await; all my 'real-world' scenarios are currently hypothetical. One such hypothetical scenario however is

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-06-01 Thread Yury Selivanov
Hi Ben, On 2015-05-31 8:35 AM, Ben Leslie wrote: Hi Yury, I'm just starting my exploration into using async/await; all my 'real-world' scenarios are currently hypothetical. One such hypothetical scenario however is that if I have a server process running, with some set of concurrent

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-05-31 Thread Ben Leslie
Hi Yury, I'm just starting my exploration into using async/await; all my 'real-world' scenarios are currently hypothetical. One such hypothetical scenario however is that if I have a server process running, with some set of concurrent connections, each managed by a co-routine. Each co-routine is

Re: [Python-Dev] Obtaining stack-frames from co-routine objects

2015-05-29 Thread Yury Selivanov
Hi Ben, Is there any real-world scenario where you would need this? It looks like this can help with debugging, somehow, but the easiest solution is to put a if debug: log(...) before yield in your switch() function. You'll have a perfect traceback there. Thanks, Yury On 2015-05-29 12:46 AM,

[Python-Dev] Obtaining stack-frames from co-routine objects

2015-05-28 Thread Ben Leslie
Hi all, Apologies in advance; I'm not a regular, and this may have been handled already (but I couldn't find it when searching). I've been using the new async/await functionality (congrats again to Yury on getting that through!), and I'd like to get a stack trace between the place at which