diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-06 20:07:17 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-06 20:07:17 +0300 |
commit | d8a1447c9980be5f1d8ae806f7aecd814b1cd6f6 (patch) | |
tree | a1966e33692ba9de3966c9760957233f51142cb2 /Python/bltinmodule.c | |
parent | 4a4b67951570a8a0452c77a5ebaa98b9ef9fb712 (diff) | |
download | cpython-git-d8a1447c9980be5f1d8ae806f7aecd814b1cd6f6.tar.gz |
Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index cbadc12218..068398fb9b 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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; } |