Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c80f0b7

Browse filesBrowse files
authored
[3.10] bpo-20028: Keep original exception when PyUnicode_GetLength return -1 (GH-28832) (GH-28834)
1 parent 8772935 commit c80f0b7
Copy full SHA for c80f0b7

File tree

1 file changed

+6
-0
lines changed
Filter options

1 file changed

+6
-0
lines changed

‎Modules/_csv.c

Copy file name to clipboardExpand all lines: Modules/_csv.c
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ _set_char_or_none(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt
244244
return -1;
245245
}
246246
Py_ssize_t len = PyUnicode_GetLength(src);
247+
if (len < 0) {
248+
return -1;
249+
}
247250
if (len > 1) {
248251
PyErr_Format(PyExc_TypeError,
249252
"\"%s\" must be a 1-character string",
@@ -274,6 +277,9 @@ _set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
274277
return -1;
275278
}
276279
Py_ssize_t len = PyUnicode_GetLength(src);
280+
if (len < 0) {
281+
return -1;
282+
}
277283
if (len > 1) {
278284
PyErr_Format(PyExc_TypeError,
279285
"\"%s\" must be a 1-character string",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.