summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes/fix_itertools_imports.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/fixes/fix_itertools_imports.py')
-rw-r--r--Lib/lib2to3/fixes/fix_itertools_imports.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/lib2to3/fixes/fix_itertools_imports.py b/Lib/lib2to3/fixes/fix_itertools_imports.py
index f4b4ead..a1702ba 100644
--- a/Lib/lib2to3/fixes/fix_itertools_imports.py
+++ b/Lib/lib2to3/fixes/fix_itertools_imports.py
@@ -43,8 +43,8 @@ class FixItertoolsImports(fixer_base.BaseFix):
else:
remove_comma ^= True
- if children[-1].type == token.COMMA:
- children[-1].remove()
+ while children and children[-1].type == token.COMMA:
+ children.pop().remove()
# If there are no imports left, just get rid of the entire statement
if (not (imports.children or getattr(imports, 'value', None)) or