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

Reduce monkeypatching in pyflakes checker #372

Merged
merged 3 commits into from
May 3, 2023

Conversation

tomasr8
Copy link
Contributor

@tomasr8 tomasr8 commented May 2, 2023

Chipping away at #183

Got rid of the monkeypatched LAMBDA.

What's changed ->

  • Default argument values cannot be forward references anymore:
def bar(x: type = SomeClass) -> None: ...  # F821 undefined name 'SomeClass'
class SomeClass: ...

I think it makes sense to not allow this anyway - it's similar to what we did with classes previously.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

I'm fine with this change, but I'll wait for a second opinion before merging.

Copy link
Collaborator

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@AlexWaygood
Copy link
Collaborator

I confirmed locally that there are no new hits on typeshed from this PR, even if F821 is reenabled in typeshed's .flake8 file.

@github-actions
Copy link

github-actions bot commented May 3, 2023

This change has no effect on typeshed. 🤖🎉

@AlexWaygood AlexWaygood merged commit b42e574 into PyCQA:main May 3, 2023
@tomasr8 tomasr8 deleted the reduce-monkeypatching branch May 3, 2023 11:50
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.

3 participants