diff options
author | Benjamin Peterson <benjamin@python.org> | 2017-09-06 03:19:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 03:19:12 (GMT) |
commit | b0a9a5a6a4786a6f8f0540e243427775d8ca245e (patch) | |
tree | 09bedca2ded5244ed7c1a0e7a726bcca9dba34da | |
parent | 76d5abc8684bac4f2fc7cccfe2cd940923357351 (diff) | |
download | cpython-b0a9a5a6a4786a6f8f0540e243427775d8ca245e.zip cpython-b0a9a5a6a4786a6f8f0540e243427775d8ca245e.tar.gz cpython-b0a9a5a6a4786a6f8f0540e243427775d8ca245e.tar.bz2 |
correct initialization code (#3376)
Explicitly initialize struct members rather than relying on compiler extensions.
-rw-r--r-- | Python/pylifecycle.c | 2 | ||||
-rw-r--r-- | Python/pystate.c | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index f33e920..3f405b1 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -77,7 +77,7 @@ extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); extern void _PyGILState_Fini(void); #endif /* WITH_THREAD */ -_PyRuntimeState _PyRuntime = {}; +_PyRuntimeState _PyRuntime = {0, 0}; void _PyRuntime_Initialize(void) diff --git a/Python/pystate.c b/Python/pystate.c index 3d32077..2d92637 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -37,8 +37,7 @@ extern "C" { void _PyRuntimeState_Init(_PyRuntimeState *runtime) { - _PyRuntimeState initial = {}; - *runtime = initial; + memset(runtime, 0, sizeof(*runtime)); _PyObject_Initialize(&runtime->obj); _PyMem_Initialize(&runtime->mem); |