Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #112203

Re: `exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2.

From eryk sun <eryksun@gmail.com>
Newsgroups comp.lang.python
Subject Re: `exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2.
Date 2016-08-02 04:48 +0000
Message-ID <mailman.106.1470113334.6033.python-list@python.org> (permalink)
References <CAPKUSf6241yGYgVag-+P_Tob_Jq_UMWCbS6TGafYk2OVXvdOSw@mail.gmail.com> <mailman.4.1469730339.6033.python-list@python.org> <9c6b75e0-67ba-4495-9ec4-fde591249c36@googlegroups.com> <CACL+1asm8rTH6dpze73CzPYE+a48OOc=v5EDyXkN5ZpOnEp09A@mail.gmail.com>

Show all headers | View raw


On Tue, Aug 2, 2016 at 1:45 AM, Lawrence D’Oliveiro
<lawrencedo99@gmail.com> wrote:
> On Friday, July 29, 2016 at 6:25:51 AM UTC+12, Enjoys Math wrote:
>
>>                 exec('obj = ' + objType + '(self)', None, _locals)
>>                 obj = _locals['obj']
>
> Why? Why not just
>
>     obj = objType(self)

I think you meant to use `globals()[objType](self)`, as was already
suggested by Chris Angelico. The value of objType appears to be the
type's name, maybe from marshaled data.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

`exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2. Enjoys Math <enjoysmath@gmail.com> - 2016-07-28 08:47 -0700
  Re: `exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2. Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-08-01 18:45 -0700
    Re: `exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2. eryk sun <eryksun@gmail.com> - 2016-08-02 04:48 +0000

csiph-web