Xavier de Gaye <xdeg...@gmail.com> added the comment: > So, in 3.1 hasattr(y, '__setstate__') *did* recurse and hit the limit, > but the exception was caught and hasattr returned False?
This is right. > I think I prefer the new behavior... > The patch looks good, I would simply have raised AttributeError(name) > though. It is fine with me to raise AttributeError(name). Note that when raising AttributeError('socket'), the user gets notified of the exceptions on both 'socket' and 'name'. For example with the patch applied: $ python3 Python 3.2 (r32:88445, Jun 18 2011, 20:30:18) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import asyncore >>> a = asyncore.dispatcher() >>> del a.socket >>> a.foo Traceback (most recent call last): File "asyncore.py", line 415, in __getattr__ retattr = getattr(self.socket, attr) File "asyncore.py", line 413, in __getattr__ % self.__class__.__name__) AttributeError: dispatcher instance has no attribute 'socket' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "asyncore.py", line 418, in __getattr__ %(self.__class__.__name__, attr)) AttributeError: dispatcher instance has no attribute 'foo' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13103> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com