Message190365
| Author |
hagen |
| Recipients |
hagen |
| Date |
2013年05月30日.15:35:58 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1369928159.24.0.947067999583.issue18102@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The following code will sometimes warn about an ignored TypeError('catching classes that do not inherit from BaseException is not allowed',) on termination:
class MyException(Exception):
pass
def gen():
try:
yield
except MyException:
pass
g = gen()
next(g)
Of course, MyException inherits from Exception, so there should be no problem.
Apparently, MyException gets destroyed before the generator object (at least sometimes, presumably depending on the hash randomization seed), and the destructor of the generator object then complains because there is no MyException any more. At least that's my explanation of this, without having digged into the code. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年05月30日 15:35:59 | hagen | set | recipients:
+ hagen |
| 2013年05月30日 15:35:59 | hagen | set | messageid: <1369928159.24.0.947067999583.issue18102@psf.upfronthosting.co.za> |
| 2013年05月30日 15:35:59 | hagen | link | issue18102 messages |
| 2013年05月30日 15:35:58 | hagen | create |
|