From a09d3901a5329fd58a29f730ae5f48fb38f66320 Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Sun, 7 May 2023 12:12:04 +0200 Subject: [3.11] gh-96670: Raise SyntaxError when parsing NULL bytes (GH-97594) (#104195) --- 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 f12b9f6e953..efa22b07256 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1859,7 +1859,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.3.1