This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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:59hagensetrecipients: + hagen
2013-05-30 15:35:59hagensetmessageid: <1369928159.24.0.947067999583.issue18102@psf.upfronthosting.co.za>
2013-05-30 15:35:59hagenlinkissue18102 messages
2013-05-30 15:35:58hagencreate