-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The fix for starmap-zip (RUF058) in Ruff 0.9.3 inserts map without checking that it is the built-in map. If map is shadowed, the fix changes the program’s behavior.
$ cat >ruf058.py <<'# EOF'
from itertools import starmap
map = {}
for _ in starmap(print, zip("A", "12")):
pass
# EOF
$ python ruf058.py
A 1
$ ruff --isolated check --preview --select RUF058 ruf058.py --fix
Found 1 error (1 fixed, 0 remaining).
$ cat ruf058.py
from itertools import starmap
map = {}
for _ in map(print, "A", "12"):
pass
$ python ruf058.py
Traceback (most recent call last):
File "ruf058.py", line 3, in <module>
for _ in map(print, "A", "12"):
^^^^^^^^^^^^^^^^^^^^^
TypeError: 'dict' object is not callableReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working