FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-36710: Remove PyImport_Cleanup() function by vstinner · Pull Request #14221 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (2) .h  (2) .rst  (2) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
15 changes: 0 additions & 15 deletions Doc/c-api/import.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -223,21 +223,6 @@ Importing Modules
Return a new reference to the finder object.
.. c:function:: void _PyImport_Init()
Initialize the import mechanism. For internal use only.
.. c:function:: void PyImport_Cleanup()
Empty the module table. For internal use only.
.. c:function:: void _PyImport_Fini()
Finalize the import mechanism. For internal use only.
.. c:function:: int PyImport_ImportFrozenModuleObject(PyObject *name)
Load a frozen module named *name*. Return ``1`` for success, ``0`` if the
Expand Down
3 changes: 3 additions & 0 deletions Doc/whatsnew/3.9.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ Deprecated
Removed
=======

* The C function ``PyImport_Cleanup()`` has been removed. It was documented as:
"Empty the module table. For internal use only."

* ``_dummy_thread`` and ``dummy_threading`` modules have been removed. These
modules were deprecated since Python 3.7 which requires threading support.
(Contributed by Victor Stinner in :issue:`37312`.)
Expand Down
1 change: 0 additions & 1 deletion Include/import.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
PyAPI_FUNC(void) PyImport_Cleanup(void);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
PyObject *name
Expand Down
1 change: 1 addition & 0 deletions Include/internal/pycore_import.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
);

extern void _PyImport_ReInitLock(void);
extern void _PyImport_Cleanup(PyThreadState *tstate);

#ifdef __cplusplus
}
Expand Down
3 changes: 1 addition & 2 deletions Python/import.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,8 @@ static const char * const sys_files[] = {
/* Un-initialize things, as good as we can */

void
PyImport_Cleanup(void)
_PyImport_Cleanup(PyThreadState *tstate)
{
PyThreadState *tstate = _PyThreadState_GET();
PyInterpreterState *interp = tstate->interp;
PyObject *modules = interp->modules;
if (modules == NULL) {
Expand Down
4 changes: 2 additions & 2 deletions Python/pylifecycle.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ Py_FinalizeEx(void)
_PySys_ClearAuditHooks();

/* Destroy all modules */
PyImport_Cleanup();
_PyImport_Cleanup(tstate);

/* Print debug stats if any */
_PyEval_Fini();
Expand Down Expand Up @@ -1589,7 +1589,7 @@ Py_EndInterpreter(PyThreadState *tstate)
if (tstate != interp->tstate_head || tstate->next != NULL)
Py_FatalError("Py_EndInterpreter: not the last thread");

PyImport_Cleanup();
_PyImport_Cleanup(tstate);
PyInterpreterState_Clear(interp);
PyThreadState_Swap(NULL);
PyInterpreterState_Delete(interp);
Expand Down

Back | FazBrowse Home | New Git URL