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
223223 Return a new reference to the finder object.
224224
225225
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-
241226.. c :function :: int PyImport_ImportFrozenModuleObject (PyObject *name)
242227
243228 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
122122Removed
123123=======
124124
125+ * The C function ``PyImport_Cleanup() `` has been removed. It was documented as:
126+ "Empty the module table. For internal use only."
127+
125128* ``_dummy_thread `` and ``dummy_threading `` modules have been removed. These
126129 modules were deprecated since Python 3.7 which requires threading support.
127130 (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(
7272PyAPI_FUNC (PyObject * ) PyImport_GetImporter (PyObject * path );
7373PyAPI_FUNC (PyObject * ) PyImport_Import (PyObject * name );
7474PyAPI_FUNC (PyObject * ) PyImport_ReloadModule (PyObject * m );
75- PyAPI_FUNC (void ) PyImport_Cleanup (void );
7675#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 >= 0x03030000
7776PyAPI_FUNC (int ) PyImport_ImportFrozenModuleObject (
7877 PyObject * name
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
1111 );
1212
1313extern void _PyImport_ReInitLock (void );
14+ extern void _PyImport_Cleanup (PyThreadState * tstate );
1415
1516#ifdef __cplusplus
1617}
Original file line number Diff line number Diff line change @@ -413,9 +413,8 @@ static const char * const sys_files[] = {
413413/* Un-initialize things, as good as we can */
414414
415415void
416- PyImport_Cleanup ( void )
416+ _PyImport_Cleanup ( PyThreadState * tstate )
417417{
418- PyThreadState * tstate = _PyThreadState_GET ();
419418 PyInterpreterState * interp = tstate -> interp ;
420419 PyObject * modules = interp -> modules ;
421420 if (modules == NULL ) {
Original file line number Diff line number Diff line change @@ -1225,7 +1225,7 @@ Py_FinalizeEx(void)
12251225 _PySys_ClearAuditHooks ();
12261226
12271227 /* Destroy all modules */
1228- PyImport_Cleanup ( );
1228+ _PyImport_Cleanup ( tstate );
12291229
12301230 /* Print debug stats if any */
12311231 _PyEval_Fini ();
@@ -1589,7 +1589,7 @@ Py_EndInterpreter(PyThreadState *tstate)
15891589 if (tstate != interp -> tstate_head || tstate -> next != NULL )
15901590 Py_FatalError ("Py_EndInterpreter: not the last thread" );
15911591
1592- PyImport_Cleanup ( );
1592+ _PyImport_Cleanup ( tstate );
15931593 PyInterpreterState_Clear (interp );
15941594 PyThreadState_Swap (NULL );
15951595 PyInterpreterState_Delete (interp );
You can’t perform that action at this time.
0 commit comments