Skip to content
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

Unify exception replacing and rewrite some TimeoutError cases #885

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

mxr
Copy link
Contributor

@mxr mxr commented Sep 12, 2023

Relates to #819. Moved oserror_aliases into exceptions & made it generalizable. Added ExceptionRewriteTarget object to store module & builtin rewrite config.

Comment on lines 13 to 16
EXC_REWRITE_TARGETS = (
exceptions.ExceptionRewriteTarget('socket', 'timeout', (3, 10)),
exceptions.ExceptionRewriteTarget('asyncio', 'TimeoutError', (3, 11)),
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I meant that these can all just live in the exceptions plugin -- no need to separate these

@asottile
Copy link
Owner

I rewrote things a bit -- it was doing a bunch of repeated O(N*M) work and didn't work for multiple names being rewritten at once

I also removed all the formatting and magic from the testsuite -- it made it a lot harder to understand what was actually being tested

Copy link
Owner

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxr
Copy link
Contributor Author

mxr commented Sep 23, 2023

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants