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

F841 unpacked vars from function call not reported as unused #16753

Closed
sk- opened this issue Mar 14, 2025 · 1 comment
Closed

F841 unpacked vars from function call not reported as unused #16753

sk- opened this issue Mar 14, 2025 · 1 comment
Labels
question Asking for support or clarification

Comments

@sk-
Copy link

sk- commented Mar 14, 2025

Summary

F841 is not reporting as unused unpacked values from function calls.

Below is some code showcasing the issue (playground):

def func(x):
    t1 = tuple([1, 2])
    a1, b1 = tuple([1, 2])

    t2 = (1, 2)
    a2, b2 = (1, 2)

In the code above a1 and b1 are not reported as unused, whereas a2 and b2 are correctly reported as unused.

Local variable `t1` is assigned to but never used (F841) [Ln 2, Col 5]
Local variable `t2` is assigned to but never used (F841) [Ln 5, Col 5]
Local variable `a2` is assigned to but never used (F841) [Ln 6, Col 5]
Local variable `b2` is assigned to but never used (F841) [Ln 6, Col 9]

Version

v0.11.0 (playground)

@ntBre
Copy link
Contributor

ntBre commented Mar 14, 2025

This is covered by the unused-unpacked-variable (RUF059) preview rule.

This is a recent addition. You can follow some of the discussion about splitting it out here if you're curious.

@ntBre ntBre added the question Asking for support or clarification label Mar 14, 2025
@sk- sk- closed this as completed Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

2 participants