From aab01e3524d966dca6e72c718a2c71403a14e47c Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Tue, 27 Sep 2022 23:23:42 +0100 Subject: gh-96670: Raise SyntaxError when parsing NULL bytes (#97594) --- Python/pythonrun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/pythonrun.c') diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 202df585f3..acb1330b85 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1858,7 +1858,7 @@ _Py_SourceAsString(PyObject *cmd, const char *funcname, const char *what, PyComp } if (strlen(str) != (size_t)size) { - PyErr_SetString(PyExc_ValueError, + PyErr_SetString(PyExc_SyntaxError, "source code string cannot contain null bytes"); Py_CLEAR(*cmd_copy); return NULL; -- cgit v1.2.1