File tree Expand file tree Collapse file tree 6 files changed +7
-20
lines changed Expand file tree Collapse file tree 6 files changed +7
-20
lines changed Original file line number Diff line number Diff line change @@ -223,21 +223,6 @@ Importing Modules
223
223
Return a new reference to the finder object.
224
224
225
225
226
- .. c :function :: void _PyImport_Init ()
227
-
228
- Initialize the import mechanism. For internal use only.
229
-
230
-
231
- .. c:function:: void PyImport_Cleanup()
232
-
233
- Empty the module table. For internal use only.
234
-
235
-
236
- .. c:function:: void _PyImport_Fini()
237
-
238
- Finalize the import mechanism. For internal use only.
239
-
240
-
241
226
.. c :function :: int PyImport_ImportFrozenModuleObject (PyObject *name)
242
227
243
228
Load a frozen module named *name *. Return ``1 `` for success, ``0 `` if the
Original file line number Diff line number Diff line change @@ -122,6 +122,9 @@ Deprecated
122
122
Removed
123
123
=======
124
124
125
+ * The C function ``PyImport_Cleanup() `` has been removed. It was documented as:
126
+ "Empty the module table. For internal use only."
127
+
125
128
* ``_dummy_thread `` and ``dummy_threading `` modules have been removed. These
126
129
modules were deprecated since Python 3.7 which requires threading support.
127
130
(Contributed by Victor Stinner in :issue: `37312 `.)
Original file line number Diff line number Diff line change @@ -72,7 +72,6 @@ PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
72
72
PyAPI_FUNC (PyObject * ) PyImport_GetImporter (PyObject * path );
73
73
PyAPI_FUNC (PyObject * ) PyImport_Import (PyObject * name );
74
74
PyAPI_FUNC (PyObject * ) PyImport_ReloadModule (PyObject * m );
75
- PyAPI_FUNC (void ) PyImport_Cleanup (void );
76
75
#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 >= 0x03030000
77
76
PyAPI_FUNC (int ) PyImport_ImportFrozenModuleObject (
78
77
PyObject * name
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
11
11
);
12
12
13
13
extern void _PyImport_ReInitLock (void );
14
+ extern void _PyImport_Cleanup (PyThreadState * tstate );
14
15
15
16
#ifdef __cplusplus
16
17
}
Original file line number Diff line number Diff line change @@ -413,9 +413,8 @@ static const char * const sys_files[] = {
413
413
/* Un-initialize things, as good as we can */
414
414
415
415
void
416
- PyImport_Cleanup ( void )
416
+ _PyImport_Cleanup ( PyThreadState * tstate )
417
417
{
418
- PyThreadState * tstate = _PyThreadState_GET ();
419
418
PyInterpreterState * interp = tstate -> interp ;
420
419
PyObject * modules = interp -> modules ;
421
420
if (modules == NULL ) {
Original file line number Diff line number Diff line change @@ -1225,7 +1225,7 @@ Py_FinalizeEx(void)
1225
1225
_PySys_ClearAuditHooks ();
1226
1226
1227
1227
/* Destroy all modules */
1228
- PyImport_Cleanup ( );
1228
+ _PyImport_Cleanup ( tstate );
1229
1229
1230
1230
/* Print debug stats if any */
1231
1231
_PyEval_Fini ();
@@ -1589,7 +1589,7 @@ Py_EndInterpreter(PyThreadState *tstate)
1589
1589
if (tstate != interp -> tstate_head || tstate -> next != NULL )
1590
1590
Py_FatalError ("Py_EndInterpreter: not the last thread" );
1591
1591
1592
- PyImport_Cleanup ( );
1592
+ _PyImport_Cleanup ( tstate );
1593
1593
PyInterpreterState_Clear (interp );
1594
1594
PyThreadState_Swap (NULL );
1595
1595
PyInterpreterState_Delete (interp );
You can’t perform that action at this time.
0 commit comments