[Python-ideas] Re: Add a way to execute code in the context of different frame

2020-02-18 Thread Guido van Rossum
On Tue, Feb 18, 2020 at 11:09 AM Serhiy Storchaka wrote: > 18.02.20 20:13, Guido van Rossum пише: > > I am a little confused how you get from "there are extra frames in the > > traceback" to "modify exec() to run code in another frame". > > Sorry for skipping several steps. I'll try to expand

[Python-ideas] Re: Add a way to execute code in the context of different frame

2020-02-18 Thread Serhiy Storchaka
18.02.20 20:13, Guido van Rossum пише: I am a little confused how you get from "there are extra frames in the traceback" to "modify exec() to run code in another frame". Sorry for skipping several steps. I'll try to expand them here. PEP 558 does not have relation to this, as frame is not the

[Python-ideas] Re: Add a way to execute code in the context of different frame

2020-02-18 Thread Guido van Rossum
I am a little confused how you get from "there are extra frames in the traceback" to "modify exec() to run code in another frame". Also, with PEP 558 (Defined semantics for locals(), by Nick Coghlan) we might be able to just pass the frame's globals and locals to exec() or eval() without further

[Python-ideas] Re: Add a way to execute code in the context of different frame

2020-02-18 Thread Serhiy Storchaka
18.02.20 11:28, M.-A. Lemburg пише: This sounds like a nice idea, but it may make sense to limit the frame to one already on the stack. Otherwise, the code you're executing may never return to your current stack... I do not think there will be such problem. exec() will temporary replace the

[Python-ideas] Re: Add a way to execute code in the context of different frame

2020-02-18 Thread M.-A. Lemburg
On 18.02.2020 08:33, Serhiy Storchaka wrote: > The idea is inspired by the following StackOverflow question: > https://stackoverflow.com/questions/40945752/inspect-who-imported-me and > the corresponding BPO issue: https://bugs.python.org/issue39643. > > In the older Python versions the f_back