[issue18102] except-clause with own exception class inside generator can lead to confusing warning on termination
Antoine Pitrou added the comment: While this is easy to reproduce under 3.3, it doesn't happen anymore under 3.4. Given how tricky it would be to fix it under 3.3 (IMO), I prefer to close the bug. -- resolution: - out of date stage: - committed/rejected status: open - closed versions: -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18102 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18102] except-clause with own exception class inside generator can lead to confusing warning on termination
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18102] except-clause with own exception class inside generator can lead to confusing warning on termination
New submission from Hagen Fürstenau: 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. -- components: Interpreter Core messages: 190365 nosy: hagen priority: normal severity: normal status: open title: except-clause with own exception class inside generator can lead to confusing warning on termination type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18102] except-clause with own exception class inside generator can lead to confusing warning on termination
Hagen Fürstenau added the comment: s/digged/dug/ :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18102] except-clause with own exception class inside generator can lead to confusing warning on termination
R. David Murray added the comment: You are almost certainly correct. MyException can get set to None during interpreter shutdown. There are a couple of active issues and a PEP that address this type of problem, so this issue probably isn't needed, but I'll leave that up to Antoine, who is working on it. -- nosy: +pitrou, r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18102] except-clause with own exception class inside generator can lead to confusing warning on termination
Antoine Pitrou added the comment: I will keep this issue alive so that I can check whether it is fixed by further changes. -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com