mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
gh-105396: Deprecate PyImport_ImportModuleNoBlock() function (#105397)
Deprecate the PyImport_ImportModuleNoBlock() function which is just an alias to PyImport_ImportModule() since Python 3.3.
This commit is contained in:
parent
a5f23d4110
commit
3e525d2212
5 changed files with 18 additions and 1 deletions
|
@ -38,6 +38,9 @@ Importing Modules
|
||||||
to per-module locks for most purposes, so this function's special
|
to per-module locks for most purposes, so this function's special
|
||||||
behaviour isn't needed anymore.
|
behaviour isn't needed anymore.
|
||||||
|
|
||||||
|
.. deprecated-removed:: 3.13 3.15
|
||||||
|
Use :c:func:`PyImport_ImportModule` instead.
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
|
.. c:function:: PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
|
||||||
|
|
||||||
|
|
|
@ -407,6 +407,11 @@ Deprecated
|
||||||
|
|
||||||
(Contributed by Victor Stinner in :gh:`105145`.)
|
(Contributed by Victor Stinner in :gh:`105145`.)
|
||||||
|
|
||||||
|
* Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function which is just
|
||||||
|
an alias to :c:func:`PyImport_ImportModule` since Python 3.3.
|
||||||
|
Scheduled for removal in Python 3.15.
|
||||||
|
(Contributed by Victor Stinner in :gh:`105396`.)
|
||||||
|
|
||||||
Removed
|
Removed
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ PyAPI_FUNC(PyObject *) PyImport_AddModule(
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
|
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
|
||||||
const char *name /* UTF-8 encoded string */
|
const char *name /* UTF-8 encoded string */
|
||||||
);
|
);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
|
Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
|
||||||
const char *name /* UTF-8 encoded string */
|
const char *name /* UTF-8 encoded string */
|
||||||
);
|
);
|
||||||
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
|
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function which is just
|
||||||
|
an alias to :c:func:`PyImport_ImportModule` since Python 3.3. Patch by
|
||||||
|
Victor Stinner.
|
|
@ -2439,6 +2439,12 @@ PyImport_ImportModule(const char *name)
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImport_ImportModuleNoBlock(const char *name)
|
PyImport_ImportModuleNoBlock(const char *name)
|
||||||
{
|
{
|
||||||
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
|
"PyImport_ImportModuleNoBlock() is deprecated and scheduled for "
|
||||||
|
"removal in Python 3.15. Use PyImport_ImportModule() instead.", 1))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return PyImport_ImportModule(name);
|
return PyImport_ImportModule(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue