Fix extract_function when the extracted code defines no variable

If the extracted lines define no name, the new function ended with a
bare "return " and the call site became " = func(v1)". Both are
invalid Python.

Only add the final return line and the assignment when there is at
least one variable to return. Otherwise call the function as a
statement.
This commit is contained in:
spicysharkco committed 2026-10-18 02:07:55 +00:00
1 parent 2af1a0f394
commit 897cbff748
3 files changed
+22 -2

No files matched your search

+1
View File
@@ -71,6 +71,7 @@ Code Contributors
- Dhanraj E (@Dhanu-dynamic) <dhanraj@labs.digiscrypt.com>
- Charan Rathore (@charan-rathore)
- Abdullah Ahmed (@abdull-ah-med)
- spicysharkco (@spicysharkco)
And a few more "anonymous" contributors.