`exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2.
eryk sun
eryksun at gmail.com
Tue Aug 2 00:48:11 EDT 2016
On Tue, Aug 2, 2016 at 1:45 AM, Lawrence D’Oliveiro
<lawrencedo99 at 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.
More information about the Python-list
mailing list