Skip to content

Commit 2dad7d3

Browse files
committed
Added compliance checks for invalid unicode characters in JSON literal
1 parent df9d9e4 commit 2dad7d3

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

jmespath.test

jmespath/lexer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def _consume_quoted_identifier(self):
236236
def _consume_raw_string_literal(self):
237237
start = self._position
238238
lexeme = self._consume_until("'").replace("\\'", "'")
239+
239240
token_len = self._position - start
240241
return {'type': 'literal', 'value': lexeme,
241242
'start': start, 'end': token_len}

tests/test_lexer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ def test_arithmetic_expression(self):
206206
]
207207
)
208208

209+
def test_invalid_character_in_json_literal(self):
210+
with self.assertRaises(LexerError) as e:
211+
tokens = list(self.lexer.tokenize(u'`0\u2028`'))
209212

210213
if __name__ == '__main__':
211214
unittest.main()

0 commit comments

Comments
 (0)