Skip to content

Fix feature detection for parenthesized context managers#4104

Merged
hauntsaninja merged 2 commits intopsf:mainfrom
JelleZijlstra:fixfeaturedetect
Dec 12, 2023
Merged

Fix feature detection for parenthesized context managers#4104
hauntsaninja merged 2 commits intopsf:mainfrom
JelleZijlstra:fixfeaturedetect

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Collaborator

This showed up in #4064.

Comment thread tests/test_black.py
self.check_features_used("a[x, *y(), z] = t", {Feature.VARIADIC_GENERICS})
self.check_features_used("def fn(*args: *T): pass", {Feature.VARIADIC_GENERICS})

self.check_features_used("with a: pass", set())
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These are the new tests. Several of them would have previously failed. The case that I ran into in one of our tests was

with (x := await a, y := await b):
        pass

@hauntsaninja hauntsaninja merged commit ebd543c into psf:main Dec 12, 2023
@JelleZijlstra JelleZijlstra deleted the fixfeaturedetect branch December 12, 2023 05:39
@JelleZijlstra JelleZijlstra restored the fixfeaturedetect branch September 10, 2024 23:36
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