2525from .exceptions import InvalidDateError
2626from .exceptions import InvalidTimeError
2727from .exceptions import InvalidNumberError
28+ from .exceptions import InvalidUnicodeValueError
2829from .exceptions import MixedArrayTypesError
2930from .exceptions import ParseError
3031from .exceptions import UnexpectedCharError
@@ -766,6 +767,8 @@ def _parse_escaped_char(self, multiline):
766767
767768 return u
768769
770+ raise self .parse_error (InvalidUnicodeValueError )
771+
769772 raise self .parse_error (InvalidCharInStringError , self ._current )
770773
771774 def _parse_string (self , delim ): # type: (StringType) -> String
@@ -1075,7 +1078,9 @@ def _peek(self, n): # type: (int) -> str
10751078 break
10761079 return buf
10771080
1078- def _peek_unicode (self , is_long ): # type: (bool) -> Tuple[bool, str]
1081+ def _peek_unicode (
1082+ self , is_long
1083+ ): # type: (bool) -> Tuple[Optional[str], Optional[str]]
10791084 """
10801085 Peeks ahead non-intrusively by cloning then restoring the
10811086 initial state of the parser.
@@ -1089,7 +1094,6 @@ def _peek_unicode(self, is_long): # type: (bool) -> Tuple[bool, str]
10891094 InternalParserError , "_peek_unicode() entered on non-unicode value"
10901095 )
10911096
1092- # AoT
10931097 self .inc () # Dropping prefix
10941098 self .mark ()
10951099
@@ -1103,6 +1107,9 @@ def _peek_unicode(self, is_long): # type: (bool) -> Tuple[bool, str]
11031107 else :
11041108 extracted = self .extract ()
11051109
1110+ if extracted [0 ].lower () == "d" and extracted [1 ].strip ("01234567" ):
1111+ return None , None
1112+
11061113 try :
11071114 value = chr (int (extracted , 16 ))
11081115 except ValueError :
0 commit comments