Skip to content

Commit

Permalink
Make ReparseException private
Browse files Browse the repository at this point in the history
ReparseException is used internally and not intended for external use.

Fixes html5lib#371
  • Loading branch information
willkg committed Nov 29, 2017
1 parent b105f6e commit 876ff02
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions html5lib/_inputstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import webencodings

from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
from .constants import ReparseException
from .constants import _ReparseException
from . import _utils

from io import StringIO
Expand Down Expand Up @@ -530,7 +530,7 @@ def changeEncoding(self, newEncoding):
self.rawStream.seek(0)
self.charEncoding = (newEncoding, "certain")
self.reset()
raise ReparseException("Encoding changed from %s to %s" % (self.charEncoding[0], newEncoding))
raise _ReparseException("Encoding changed from %s to %s" % (self.charEncoding[0], newEncoding))

def detectBOM(self):
"""Attempts to detect at BOM at the start of the stream. If
Expand Down
2 changes: 1 addition & 1 deletion html5lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2943,5 +2943,5 @@ class DataLossWarning(UserWarning):
pass


class ReparseException(Exception):
class _ReparseException(Exception):
pass
4 changes: 2 additions & 2 deletions html5lib/html5parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
adjustForeignAttributes as adjustForeignAttributesMap,
adjustMathMLAttributes, adjustSVGAttributes,
E,
ReparseException
_ReparseException
)


Expand Down Expand Up @@ -83,7 +83,7 @@ def _parse(self, stream, innerHTML=False, container="div", scripting=False, **kw

try:
self.mainLoop()
except ReparseException:
except _ReparseException:
self.reset()
self.mainLoop()

Expand Down

0 comments on commit 876ff02

Please sign in to comment.