pyrefly icon indicating copy to clipboard operation
pyrefly copied to clipboard

panic: key lacking binding with fuzzed assignment expressions and comprehensions

Open correctmost opened this issue 6 months ago • 4 comments

Describe the Bug

Pyrefly crashes when checking this fuzzed code:

[(c:=)for c+]
[(c:=)for]
ERROR Thread panicked, shutting down: panicked at pyrefly/lib/binding/bindings.rs:518:13:
Internal error: key lacking binding, module=__unknown__, path=/home/user/crash.py, key=Key::Anywhere(c 1:3-4), key-debug=Anywhere((Name("c"), 2..3))

Version info

Reproducible with 1.1.0.dev1 and commit 9ef0830d5

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIA2gBQDGiAvAJRi4BOABLQNQC6AOuhr1mrNgPQgANCDJsYYKKUIAXXAFsoFAMQcACqXmLSHNFjz4uudJADmAVzaoVEa4UG6AyjBgcAFioqxHCIAPShcgpKhOy2oTDooZi4tHChtNZ2js6uiRxiHKgAbqjQqNiwVjYQDk4u1hy4xPXocO7oZCp%2B1gC0RTBscLkcDBz8IADMhACMAEzjgpQDbOxwEvboEOrE7CowmD2YEPK0Lv0jHADkNejsMJeCtyo98gCO9sf7PQDWMKQ9qFotHgcAulwA7qg2OgHpIAL4yQFnGAAMWgMAoZhwBBI5DhQA

(Only applicable for extension issues) IDE Information

No response

correctmost avatar Jun 03 '26 20:06 correctmost

I can take this.

mikeleppane avatar Jun 05 '26 06:06 mikeleppane

This issue has someone assigned, but has not had recent activity for more than 2 weeks.

If you are still working on this issue, please add a comment so everyone knows. Otherwise, please unassign yourself and allow someone else to take over.

Thank you for your contributions!

github-actions[bot] avatar Jul 02 '26 01:07 github-actions[bot]

Hi @mikeleppane, are you still working on this one? We hit the same crash from #4403 and have a fix ready to put up. Happy to hold off if you're close, otherwise we'll go ahead later this week.

shahhamdihassan avatar Sep 24 '26 15:09 shahhamdihassan

Thanks for the report @correctmost! The crash came from a walrus inside a comprehension not being recorded in the outer scope when the name is assigned more than once. @mikeleppane, we haven't heard back since September, so we've put up a fix and this will close once it lands.

shahhamdihassan avatar Oct 19 '26 13:10 shahhamdihassan