[Python-checkins] Fix a compiler warning in _xxsubinterpretermodule.c (#103245)

Yhg1s webhook-mailer at python.org
Tue Apr 4 10:51:47 EDT 2023


https://github.com/python/cpython/commit/89e6a3446184925ee7f17cd0d948c7784a88b8d7
commit: 89e6a3446184925ee7f17cd0d948c7784a88b8d7
branch: main
author: T. Wouters <thomas at python.org>
committer: Yhg1s <thomas at python.org>
date: 2023-04-04T16:51:30+02:00
summary:

Fix a compiler warning in _xxsubinterpretermodule.c (#103245)

Fix a (correct) warning about potential uses of uninitialized memory in
_xxsubinterpreter. Unlike newly allocated PyObject structs or global
structs, stack-allocated structs are not initialised, and a few places in
the code expect the _sharedexception struct data to be either NULL or
initialised.

files:
M Modules/_xxsubinterpretersmodule.c

diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 9648f080cd75..11164676c4d1 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -481,7 +481,7 @@ _run_script_in_interpreter(PyObject *mod, PyInterpreterState *interp,
     }
 
     // Run the script.
-    _sharedexception exc;
+    _sharedexception exc = {NULL, NULL};
     int result = _run_script(interp, codestr, shared, &exc);
 
     // Switch back.



More information about the Python-checkins mailing list