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 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, name)

This is a (common) bug in your program. __getattr__ should call self.__dict__(name) to avoid the recursion.

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to