Skip to content

Commit 35c9fea

Browse files
committed
Implement C API function PyUnicode_DecodeASCII.
1 parent b80df21 commit 35c9fea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

graalpython/com.oracle.graal.python.cext/src/unicodeobject.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,15 @@ PyObject * PyUnicode_AsUnicodeEscapeString(PyObject *unicode) {
479479

480480
UPCALL_ID(PyUnicode_Decode);
481481
PyObject * PyUnicode_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) {
482+
if (errors == NULL) {
483+
errors = "strict";
484+
}
482485
if (encoding == NULL) {
483486
return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL);
484487
}
485488
return UPCALL_CEXT_O(_jls_PyUnicode_Decode, s, size, polyglot_from_string(encoding, SRC_CS), polyglot_from_string(errors, SRC_CS));
486489
}
490+
491+
PyObject * PyUnicode_DecodeASCII(const char *s, Py_ssize_t size, const char *errors) {
492+
return PyUnicode_Decode(s, size, "ascii", errors);
493+
}

0 commit comments

Comments
 (0)