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

2015-06-13 Thread Nick Coghlan
On 14 Jun 2015 10:01, "Ben Leslie" 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 finished revisi

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" wrote: > > On Sat, Jun 13, 2015 at 9:21 AM, Nick Coghlan 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 delegated control", while

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 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 generator-iterator >> or coro

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 implem

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..

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 wrote: > On 13 June 2015 at 20:25, Ben Leslie 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 y

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 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 > empty stack

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 thre

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 wrote: > On Sat, Jun 13, 2015 at 12:22 AM, Nick Coghlan wrote: >> >> On 13 June 2015 at 04:13, Guido van Rossum wrote: >> > IOW I don't think that the problem here is that you haven't sufficiently >> > motivated your use case -- you are asking for infor

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 wrote: > On 13 June 2015 at 04:13, Guido van Rossum 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 w

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 wrote: > On 13 June 2015 at 04:13, Guido van Rossum 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 sta

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 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 frame of the