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

2016-08-01 Thread eryk sun
On Tue, Aug 2, 2016 at 1:45 AM, Lawrence D’Oliveiro 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

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

2016-08-01 Thread Lawrence D’Oliveiro
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) ? -- https://mail.python.org/mailman/listinfo/python-list

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

2016-07-28 Thread eryk sun
On Thu, Jul 28, 2016 at 6:40 PM, Chris Angelico wrote: > On Fri, Jul 29, 2016 at 1:47 AM, Enjoys Math wrote: >> I've manually set breakpoints and traced this app crash back to this >> function: >> >> def loadLSobjsOfType(self, objType, listJ): >> if listJ != None: >> for o

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

2016-07-28 Thread Random832
On Thu, Jul 28, 2016, at 11:47, Enjoys Math wrote: > So what's the proper way to get the return value of an exec call when > there is one? Exec calls do not have return values. If you need to pass an object out of the exec call to the surrounding context, you can wrap it in an exception and throw

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

2016-07-28 Thread Chris Angelico
On Fri, Jul 29, 2016 at 1:47 AM, Enjoys Math wrote: > I've manually set breakpoints and traced this app crash back to this > function: > > def loadLSobjsOfType(self, objType, listJ): > if listJ != None: > for objJ in listJ: > _locals = locals() >

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

2016-07-28 Thread Enjoys Math
I've manually set breakpoints and traced this app crash back to this function: def loadLSobjsOfType(self, objType, listJ): if listJ != None: for objJ in listJ: _locals = locals() exec('obj = ' + objType + '(self)', None, _locals)