Skip to content

False negative involving partial assignment and walrus #22262

Open

Description

@hauntsaninja
def f() -> int:
    x = None
    x = (x, (x := 1))
    return x

print(f())  # (None, 1)

Found by Codex

Activity

  1. changed the title [-]False negative involving partial assignment[/-] [+]False negative involving partial assignment and walrus[/+] on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions