8000 Quick hack to fix parsing from stdin · awesome-python/html5lib-python@3bff377 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3bff377

Browse files
committed
Quick hack to fix parsing from stdin
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401269
1 parent d7be730 commit 3bff377

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/html5lib/inputstream.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import codecs
22
import re
33
import types
4+
import sys
45

56
from constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
67
from constants import encodings, ReparseException
@@ -180,7 +181,8 @@ def openStream(self, source):
180181
import cStringIO
181182
stream = cStringIO.StringIO(str(source))
182183

183-
if not(hasattr(stream, "tell") and hasattr(stream, "seek")):
184+
if (not(hasattr(stream, "tell") and hasattr(stream, "seek")) or
185+
stream is sys.stdin):
184186
stream = BufferedStream(stream)
185187

186188
return stream

0 commit comments

Comments
 (0)
0