Skip to content

RUF056 fix introduces a syntax error for a parenthesized value #18798

@dscorbett

Description

@dscorbett

Summary

The fix for falsy-dict-get-fallback (RUF056) introduces a syntax error when the falsy value is parenthesized.

$ cat >ruf056.py <<'# EOF'
d = {}
not d.get("key", (False))
# EOF

$ ruff --isolated check ruf056.py --select RUF056 --preview --diff 2>&1 | grep error:
error: Fix introduced a syntax error. Reverting all changes.

Version

ruff 0.12.0 (87f0feb 2025-06-17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions