Open berleant opened 7 years ago
parse_stylesheet
expects a string. Some of the things it does with it is getting its length with len(css_source)
and indexing it to get a character with char = css_source[pos]
where pos
is an integer. These happen to work on a list, but that’s an accident. With a string char
is a character represented as a string whose length is always 1. In some cases like this one, pos
is incremented by len(char)
which is normally 1. But with a list containing an empty string, pos
is incremented by 0 and the next iteration of the loop does the same thing again. And you get an infinite loop.
Maybe we can tweak the code so that this situation raises an exception instead of looping infinitely. But calling parse_stylesheet
with a list rather than a string is always an error in the first place.
Looping indefinitely seems like non-ideal behavior to me, but you're right, it's not technically a bug.