8000 Visit deferred lambdas before type definitions by charliermarsh · Pull Request #9540 · astral-sh/ruff · GitHub
[go: up one dir, main page]

Skip to content

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
@codspeed-hq
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%

@github-actions
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
@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

2 participants

0