Skip to content

Commit b0a9a5a

Browse files
authored
correct initialization code (python#3376)
Explicitly initialize struct members rather than relying on compiler extensions.
1 parent 76d5abc commit b0a9a5a

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
7777
extern void _PyGILState_Fini(void);
7878
#endif /* WITH_THREAD */
7979

80-
_PyRuntimeState _PyRuntime = {};
80+
_PyRuntimeState _PyRuntime = {0, 0};
8181

8282
void
8383
_PyRuntime_Initialize(void)

Python/pystate.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ extern "C" {
3737
void
3838
_PyRuntimeState_Init(_PyRuntimeState *runtime)
3939
{
40-
_PyRuntimeState initial = {};
41-
*runtime = initial;
40+
memset(runtime, 0, sizeof(*runtime));
4241

4342
_PyObject_Initialize(&runtime->obj);
4443
_PyMem_Initialize(&runtime->mem);

0 commit comments

Comments
 (0)