We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3abd50d commit 4b608d3Copy full SHA for 4b608d3
Python/remove-comments.py
@@ -93,13 +93,13 @@ def removeComments(self, source):
93
if not in_block:
94
newline = []
95
while i < len(line):
96
- if line[i:i+2] == '/*' and not in_block:
+ if not in_block and i+1 < len(line) and line[i:i+2] == '/*':
97
in_block = True
98
i += 1
99
- elif line[i:i+2] == '*/' and in_block:
+ elif in_block and i+1 < len(line) and line[i:i+2] == '*/':
100
in_block = False
101
102
- elif not in_block and line[i:i+2] == '//':
+ elif not in_block and i+1 < len(line) and line[i:i+2] == '//':
103
break
104
elif not in_block:
105
newline.append(line[i])
0 commit comments