-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
When the following program is provided with a specially crafted input, this leads to an index out of range error in the extract_package_name
function at line 264 in autoflake.py
. This seems to stem from incorrect handling of a carriage return character in the input text(\r
).
import autoflake
autoflake.fix_code("import t\rs\nimport test\nimport0")
Setup Info
Version: 2.31
Commit: b87ff10
Trace Report
Traceback (most recent call last):
File "rep.py", line 3, in <module>
autoflake.fix_code("import t\rs\nimport test\nimport0")
File "python3.10/site-packages/autoflake.py", line 924, in fix_code
"".join(
File "python3.10/site-packages/autoflake.py", line 622, in filter_code
result = filter_unused_import(
File "python3.10/site-packages/autoflake.py", line 699, in filter_unused_import
package = extract_package_name(line)
File "python3.10/site-packages/autoflake.py", line 264, in extract_package_name
word = line.split()[1]
IndexError: list index out of range
Metadata
Metadata
Assignees
Labels
No labels