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

Visit deferred lambdas before type definitions #9540

Merged
merged 1 commit into from
Jan 16, 2024
Merged

Conversation

charliermarsh
Copy link
Member

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):

import re

cast(lambda: re.match, 1)

Closes #9534.

@charliermarsh charliermarsh added the bug Something isn't working label Jan 16, 2024
Copy link

codspeed-hq bot commented Jan 16, 2024

CodSpeed Performance Report

Merging #9540 will degrade performances by 4.35%

Comparing charlie/cast (5c424f0) with main (b983ab1)

Summary

❌ 1 regressions
✅ 29 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main charlie/cast Change
parser[numpy/ctypeslib.py] 12.2 ms 12.8 ms -4.35%

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh merged commit da275b8 into main Jan 16, 2024
16 of 17 checks passed
@charliermarsh charliermarsh deleted the charlie/cast branch January 16, 2024 01:08
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.

False positive F401 "imported but unused" when use is cast() inside a lambda
1 participant