Re: [Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread Akira Li
"Schmitt Uwe (ID SIS)" writes: > I discovered a problem using cPickle.loads from CPython 2.7.6. > > The last line in the following code raises an infinite recursion > > class T(object): > > def __init__(self): > self.item = list() > > def __getattr__(self, name):

Re: [Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread Peter Otten
Chris Angelico wrote: > On Mon, Aug 11, 2014 at 9:40 PM, Peter Otten <__pete...@web.de> wrote: >> Read again. The OP tries to delegate attribute lookup to an (existing) >> attribute. >> >> IMO the root cause of the problem is that pickle looks up __dunder__ >> methods in the instance rather than t

Re: [Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread R. David Murray
On Mon, 11 Aug 2014 21:43:00 +1000, Chris Angelico wrote: > On Mon, Aug 11, 2014 at 9:40 PM, Peter Otten <__pete...@web.de> wrote: > > Read again. The OP tries to delegate attribute lookup to an (existing) > > attribute. > > > > IMO the root cause of the problem is that pickle looks up __dunder__

Re: [Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread Chris Angelico
On Mon, Aug 11, 2014 at 9:40 PM, Peter Otten <__pete...@web.de> wrote: > Read again. The OP tries to delegate attribute lookup to an (existing) > attribute. > > IMO the root cause of the problem is that pickle looks up __dunder__ methods > in the instance rather than the class. The recursion comes

Re: [Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread Peter Otten
Terry Reedy wrote: > On 8/11/2014 5:10 AM, Schmitt Uwe (ID SIS) wrote: > > Python usage questions should be directed to python-list, for instance. > >> I discovered a problem using cPickle.loads from CPython 2.7.6. > > The problem is your code having infinite recursion. You only discovered > it

Re: [Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread Terry Reedy
On 8/11/2014 5:10 AM, Schmitt Uwe (ID SIS) wrote: Python usage questions should be directed to python-list, for instance. I discovered a problem using cPickle.loads from CPython 2.7.6. The problem is your code having infinite recursion. You only discovered it with pickle. The last line i

[Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread Schmitt Uwe (ID SIS)
Dear all, I discovered a problem using cPickle.loads from CPython 2.7.6. The last line in the following code raises an infinite recursion class T(object): def __init__(self): self.item = list() def __getattr__(self, name): return getattr(self.item, n