Commit b0a9a5a6 authored by Benjamin Peterson's avatar Benjamin Peterson Committed by GitHub

correct initialization code (#3376)

Explicitly initialize struct members rather than relying on compiler extensions.
parent 76d5abc8
...@@ -77,7 +77,7 @@ extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); ...@@ -77,7 +77,7 @@ extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
extern void _PyGILState_Fini(void); extern void _PyGILState_Fini(void);
#endif /* WITH_THREAD */ #endif /* WITH_THREAD */
_PyRuntimeState _PyRuntime = {}; _PyRuntimeState _PyRuntime = {0, 0};
void void
_PyRuntime_Initialize(void) _PyRuntime_Initialize(void)
......
...@@ -37,8 +37,7 @@ extern "C" { ...@@ -37,8 +37,7 @@ extern "C" {
void void
_PyRuntimeState_Init(_PyRuntimeState *runtime) _PyRuntimeState_Init(_PyRuntimeState *runtime)
{ {
_PyRuntimeState initial = {}; memset(runtime, 0, sizeof(*runtime));
*runtime = initial;
_PyObject_Initialize(&runtime->obj); _PyObject_Initialize(&runtime->obj);
_PyMem_Initialize(&runtime->mem); _PyMem_Initialize(&runtime->mem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment