Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 95db2e7

Browse files
committed
Backout 62658d9d8926 (issue #10241): it causes a crash at shutdown when deallocating a Tkapp object.
1 parent 865d12a commit 95db2e7

4 files changed

Lines changed: 0 additions & 33 deletions

File tree

Include/pystate.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ PyAPI_FUNC(int) PyState_AddModule(PyObject*, struct PyModuleDef*);
134134
PyAPI_FUNC(int) PyState_RemoveModule(struct PyModuleDef*);
135135
#endif
136136
PyAPI_FUNC(PyObject*) PyState_FindModule(struct PyModuleDef*);
137-
#ifndef Py_LIMITED_API
138-
PyAPI_FUNC(void) _PyState_ClearModules(void);
139-
#endif
140137

141138
PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
142139
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);

Misc/NEWS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ Core and Builtins
1212

1313
- Issue #17899: Fix rare file descriptor leak in os.listdir().
1414

15-
- Issue #10241: Clear extension module dict copies at interpreter shutdown.
16-
Patch by Neil Schemenauer, minimally modified.
17-
1815
- Issue #9035: ismount now recognises volumes mounted below a drive root
1916
on Windows. Original patch by Atsuo Ishimoto.
2017

Python/import.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,6 @@ PyImport_Cleanup(void)
380380
builtins = interp->builtins;
381381
interp->builtins = PyDict_New();
382382
Py_DECREF(builtins);
383-
/* Clear module dict copies stored in the interpreter state */
384-
_PyState_ClearModules();
385383
/* Collect references */
386384
_PyGC_CollectNoFail();
387385
/* Dump GC stats before it's too late, since it uses the warnings

Python/pystate.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -320,31 +320,6 @@ PyState_RemoveModule(struct PyModuleDef* def)
320320
return PyList_SetItem(state->modules_by_index, index, Py_None);
321321
}
322322

323-
/* used by import.c:PyImport_Cleanup */
324-
void
325-
_PyState_ClearModules(void)
326-
{
327-
PyInterpreterState *state = PyThreadState_GET()->interp;
328-
if (state->modules_by_index) {
329-
Py_ssize_t i;
330-
for (i = 0; i < PyList_GET_SIZE(state->modules_by_index); i++) {
331-
PyObject *m = PyList_GET_ITEM(state->modules_by_index, i);
332-
if (PyModule_Check(m)) {
333-
/* cleanup the saved copy of module dicts */
334-
PyModuleDef *md = PyModule_GetDef(m);
335-
if (md)
336-
Py_CLEAR(md->m_base.m_copy);
337-
}
338-
}
339-
/* Setting modules_by_index to NULL could be dangerous, so we
340-
clear the list instead. */
341-
if (PyList_SetSlice(state->modules_by_index,
342-
0, PyList_GET_SIZE(state->modules_by_index),
343-
NULL))
344-
PyErr_WriteUnraisable(state->modules_by_index);
345-
}
346-
}
347-
348323
void
349324
PyThreadState_Clear(PyThreadState *tstate)
350325
{

0 commit comments

Comments
 (0)