Skip to content

False positive on parenthezised del statements #5177

Closed

Description

@sk-

Describe the Bug

del (a, b) is valid Python and runs fine, but pyrefly 1.3.2 reports it as an invalid target (unsupported-delete)

The following code shows the issue

a = 1
b = 2
del (a, b)
$ pyrefly check mre.py
ERROR Invalid target for `del` [unsupported-delete]
 --> mre.py:3:5
  |
3 | del (a, b)
  |     ^^^^^^
Expected: no error, same as del a, b. del [a, b] fails the same way; del (a) and del (x["k"]) are accepted.

This matters in practice because both ruff and black emit this form whenever the target list exceeds the line length.

Sandbox Link

https://pyrefly.org/sandbox/?project=v2.w1VkJgJtM4zJSwJSRqBkmaOgkaijkKSJ6WtlhQCIgALUAGB-BwZXeimwVAEGg15MnjKwQElVyCgpKSi20teHac8vStdPzdNPyU8u1kfRoa8AiuDEssRMcFmFapxCPjiWioHGUhLc6pDQVscX2OqgsAaqwBt-AA

(Only applicable for extension issues) IDE Information

No response

Activity

  1. shahhamdihassan commented on Oct 14, 2026

    @shahhamdihassan
    Contributor

    Thanks for the report! This reproduces on main for both del (a, b) and del [a, b], because pyrefly treated the parenthesized or bracketed list as one invalid target instead of deleting each name in it: https://pyrefly.org/sandbox/?project=v2.q8ZRZCbqKCQBixodBWABA0waaUDLDXUUjHQUjHUUTHQUTHUUzECpNUcBpFBBQVkhtaIAlBgV8sCpDCSjAdKtiSxXmldcWgDzfGpOaglUZTTIhlhCKvH6AwA A small fix is being prepared, and this will close once it lands.

  2. shahhamdihassan commented on Oct 16, 2026

    @shahhamdihassan
    Contributor

    Thanks for the report! The fix has landed and will be in the next release.

  3. sk- commented on Nov 13, 2026

    @sk-
    Author

    For anyone coming here, this is still not released and will be released in version 1.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions