Skip to content

Commit e6aa018

Browse files
authored
Allow only module's exec() to create interp-dict
by using get_current_module()
1 parent 1539cc6 commit e6aa018

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_datetimemodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ static datetime_state *
159159
_get_current_state(PyObject **p_mod)
160160
{
161161
PyInterpreterState *interp = PyInterpreterState_Get();
162+
assert(interp->dict != NULL);
162163
PyObject *mod = get_current_module(interp, NULL);
163164
if (mod == NULL) {
164165
assert(!PyErr_Occurred());
@@ -185,6 +186,7 @@ _get_current_state(PyObject **p_mod)
185186
static int
186187
set_current_module(PyInterpreterState *interp, PyObject *mod)
187188
{
189+
assert(interp->dict != NULL);
188190
assert(mod != NULL);
189191
PyObject *dict = PyInterpreterState_GetDict(interp);
190192
if (dict == NULL) {

0 commit comments

Comments
 (0)