Skip to content

Iterate over lambdas in deferred type annotations#9175

Merged
charliermarsh merged 1 commit intomainfrom
charlie/defer
Dec 18, 2023
Merged

Iterate over lambdas in deferred type annotations#9175
charliermarsh merged 1 commit intomainfrom
charlie/defer

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Closes #9159.

@charliermarsh charliermarsh added the bug Something isn't working label Dec 18, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) December 18, 2023 04:49
@charliermarsh charliermarsh merged commit 2643f74 into main Dec 18, 2023
@charliermarsh charliermarsh deleted the charlie/defer branch December 18, 2023 04:51
@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

charliermarsh added a commit that referenced this pull request Jan 16, 2024
## Summary

This is effectively the same problem as
#9175. And this just papers over
it again, though I'm gonna try a more holistic fix in a follow-up PR.
The _real_ fix here is that we need to continue to visit deferred items
until they're exhausted since, e.g., we still get this case wrong
(flagging `re` as unused):

```python
import re

cast(lambda: re.match, 1)
```

Closes #9534.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PEP 695 type annotations with lambdas produce false F401

2 participants