Skip to content

Commit 2f66b5f

Browse files
authored
Add support for encoding-error handling with memoized tests (#376)
Currently, Unicode surrogate pairs are supported only in non-memoized tests. This simple change fixes the memoized tests also.
1 parent 89c32e6 commit 2f66b5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

grammarinator/tool/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def _memoize_test(self, input: str) -> bool:
299299
# is evicted.
300300
if self._memo_size < 1:
301301
return True
302-
test = xxhash.xxh3_64_intdigest(input)
302+
test = xxhash.xxh3_64_intdigest(input.encode(encoding=self._encoding, errors=self._errors))
303303
if test in self._memo:
304304
return False
305305
self._memo[test] = None

0 commit comments

Comments
 (0)