Message144970
| Author |
xdegaye |
| Recipients |
amaury.forgeotdarc, giampaolo.rodola, josiahcarlson, stutzbach, xdegaye |
| Date |
2011年10月05日.21:00:24 |
| SpamBayes Score |
1.0889531e-07 |
| Marked as misclassified |
No |
| Message-id |
<1317848425.1.0.101840696169.issue13103@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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' |
|