Skip to content

Commit 0ba6628

Browse files
jdufresnegsnedders
authored andcommitted
Remove unnecessary compatibility shim for BytesIO (#401)
io.BytesIO is available on all supported Pythons. Can simplify by assuming the import will succeed.
1 parent fd04f6a commit 0ba6628

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

html5lib/_inputstream.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@
55

66
import codecs
77
import re
8+
from io import BytesIO, StringIO
89

910
import webencodings
1011

1112
from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
1213
from .constants import _ReparseException
1314
from . import _utils
1415

15-
from io import StringIO
16-
17-
try:
18-
from io import BytesIO
19-
except ImportError:
20-
BytesIO = StringIO
21-
2216
# Non-unicode versions of constants for use in the pre-parser
2317
spaceCharactersBytes = frozenset([item.encode("ascii") for item in spaceCharacters])
2418
asciiLettersBytes = frozenset([item.encode("ascii") for item in asciiLetters])

0 commit comments

Comments
 (0)