8000 Fix test_newlines · html5lib/html5lib-python@c69c726 · GitHub
[go: up one dir, main page]

Skip to content

Commit c69c726

Browse files
committed
Fix test_newlines
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40769
1 parent ba5a67c commit c69c726

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/inputstream.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,11 @@ def charsUntil(self, characters, opposite = False):
204204
# Put the character stopped on back to the front of the queue
205205
# from where it came.
206206
c = charStack.pop()
207-
self.queue.insert(0, c)
208-
209-
# XXX the following is need for correct line number reporting apparently
210-
# but it causes to break other tests with the fixes in tokenizer. I have
211-
# no idea why...
212-
#
213-
#if c != EOF and self.tell <= len(self.dataStream) and \
214-
# self.dataStream[self.tell - 1] == c[0]:
215-
# self.tell -= 1
216-
#else:
217-
# self.queue.insert(0, c)
207+
if c != EOF and self.tell > 0 and not self.queue and \
208+
self.dataStream[self.tell - 1] == c[0]:
209+
self.tell -= 1
210+
else:
211+
self.queue.insert(0, c)
218212
return "".join(charStack)
219213

220214
class EncodingBytes(str):

0 commit comments

Comments
 (0)
0