Skip to content

Commit 6bd0c0a

Browse files
committed
throw error if unicode_escape_encode param is no str
1 parent 4b4add5 commit 6bd0c0a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

graalpython/lib-graalpython/_codecs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ def utf_32_ex_decode(data, errors=None, byteorder=0, final=False):
247247

248248
@__builtin__
249249
def unicode_escape_encode(string, errors=None):
250+
if not isinstance(string, str):
251+
raise TypeError("unicode_escape_encode() argument 1 must be str, not %s", type(string))
250252
return __truffle_encode(repr(string)[1:-1], "latin-1", errors)
251253

252254

0 commit comments

Comments
 (0)