diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py index 9f4819caa27..501fe36d79d 100644 --- a/Lib/sgmllib.py +++ b/Lib/sgmllib.py @@ -354,7 +354,7 @@ class SGMLParser: def handle_charref(self, name): try: n = int(name) - except string.atoi_error: + except ValueError: self.unknown_charref(name) return if not 0 <= n <= 255: