Re: Strange namespace issue

2020-08-11 Thread Chris Angelico
On Wed, Aug 12, 2020 at 12:03 PM Lele Gaifax wrote: > But I see this is somewhat fragile, and wonder about a proper fix, but isn't > that a reasonable usage of the "locals" argument to exec()? > I'm not sure. Passing a locals argument to eval() I have sometimes done, but never exec(). I've always

Re: Strange namespace issue

2020-08-11 Thread Lele Gaifax
Chris Angelico writes: > Interesting. You're passing an empty globals and a non-empty locals > (the second and third arguments to exec, respectively). Is that > deliberate? By the look of this code, it's meant to be at global scope > (as if it's the top level code in a module), which is best done

Re: Strange namespace issue

2020-08-10 Thread Chris Angelico
On Tue, Aug 11, 2020 at 5:44 AM Lele Gaifax wrote: > > Hi all, > > today I faced an issue that, although very easy to fix, left me wondering > about what causes it. > > The context is an application that execute small scripts coming from an > external source (say, a database). The application firs