◐ Shell
clean mode source ↗

gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed by vstinner · Pull Request #146113 · python/cpython

Expand Up @@ -315,8 +315,12 @@ _set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt) static int _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt) { if (src == NULL) if (src == NULL) { *target = PyUnicode_DecodeASCII(dflt, strlen(dflt), NULL); if (*target == NULL) { return -1; } } else { if (!PyUnicode_Check(src)) { PyErr_Format(PyExc_TypeError, Expand Down