mirror of
https://github.com/python/cpython.git
synced 2025-09-05 00:11:10 +00:00
Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
This commit is contained in:
parent
4a4b679515
commit
d8a1447c99
14 changed files with 41 additions and 39 deletions
|
@ -745,8 +745,8 @@ source_as_string(PyObject *cmd, char *funcname, char *what, PyCompilerFlags *cf)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (strlen(str) != (size_t)size) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
if (strlen(str) != (size_t)size) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"source code string cannot contain null bytes");
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue