New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible simplification for old-style exception handling code in stdlib #60345
Comments
I just noticed that StreamHandler contains the following fragment in its emit() method: try: Couldn't this be simplified to the following? try: I.e. instead of manually catching and re-raising a few BaseExceptions, just don't catch anything that derives from BaseException but not from Exception? (I noticed because we have an internal clone of this class that occasionally gets augmented with yet another base exception that shouldn't be handled. |
I think this is idiomatic now (since 2.5). There are some places where similar outdated code used. See the attached patch. There are more dubious places in Lib/multiprocessing/managers.py and Lib/asyncore.py. |
New changeset 46889b772442 by Vinay Sajip in branch 'default': |
Shouldn't this issue be closed? (the proposed patch was applied in Oct. last year) |
I'm guessing Serhiy left it open because of the question about multiprocessing and asyncore. Given that he rated them as dubious, let's just close it. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: