Skip to content

Conversation

@jakkdl
Copy link
Contributor

@jakkdl jakkdl commented Nov 25, 2025

fixes #525

it also silences the error if it detects __str__ and any of the pickle dunders.

please have opinions on the README blurb!

@jakkdl jakkdl changed the title ignore overloaded init, accept exceptions with str+pickle dunder, improve README b042: ignore overloaded init, ignore if str+pickle dunder, improve README Nov 25, 2025
@jakkdl jakkdl mentioned this pull request Nov 25, 2025
Copy link
Contributor

@kurtmckee kurtmckee left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this!

Comment on lines +53 to +58
# ignore overloaded __init__
class MyException(Exception):
@overload
def __init__(self, x: int): ...
@overload
def __init__(self, x: float): ...
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

Choose a reason for hiding this comment

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

I've tested this branch and confirmed that it resolves the false positive I posted in #525.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks Kurt!

Co-authored-by: Kurt McKee <[email protected]>
Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

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

Many thanks @jakkdl for the improvements !

@cooperlees cooperlees requested a review from kurtmckee November 26, 2025 02:14
@cooperlees cooperlees merged commit 0afdcce into PyCQA:main Nov 26, 2025
6 checks passed
@jakkdl jakkdl deleted the b042_impro branch November 26, 2025 12:42
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.

B042 false positive

3 participants