[Python-checkins] bpo-45855: document that `no_block` has no use anymore in PyCapsule_Import (#29665)
birkenfeld
webhook-mailer at python.org
Sun Dec 12 04:49:57 EST 2021
https://github.com/python/cpython/commit/f4095e53ab708d95e019c909d5928502775ba68f
commit: f4095e53ab708d95e019c909d5928502775ba68f
branch: main
author: Georg Brandl <georg at python.org>
committer: birkenfeld <georg at python.org>
date: 2021-12-12T10:49:50+01:00
summary:
bpo-45855: document that `no_block` has no use anymore in PyCapsule_Import (#29665)
files:
A Misc/NEWS.d/next/C API/2021-12-12-10-09-02.bpo-45855.MVsTDj.rst
M Doc/c-api/capsule.rst
M Objects/capsule.c
diff --git a/Doc/c-api/capsule.rst b/Doc/c-api/capsule.rst
index 908e92653dd48..2c4cfc48f9a27 100644
--- a/Doc/c-api/capsule.rst
+++ b/Doc/c-api/capsule.rst
@@ -103,13 +103,14 @@ Refer to :ref:`using-capsules` for more information on using these objects.
Import a pointer to a C object from a capsule attribute in a module. The
*name* parameter should specify the full name to the attribute, as in
``module.attribute``. The *name* stored in the capsule must match this
- string exactly. If *no_block* is true, import the module without blocking
- (using :c:func:`PyImport_ImportModuleNoBlock`). If *no_block* is false,
- import the module conventionally (using :c:func:`PyImport_ImportModule`).
+ string exactly.
Return the capsule's internal *pointer* on success. On failure, set an
exception and return ``NULL``.
+ .. versionchanged:: 3.3
+ *no_block* has no effect anymore.
+
.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
diff --git a/Misc/NEWS.d/next/C API/2021-12-12-10-09-02.bpo-45855.MVsTDj.rst b/Misc/NEWS.d/next/C API/2021-12-12-10-09-02.bpo-45855.MVsTDj.rst
new file mode 100644
index 0000000000000..e00d56e0e4ad2
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2021-12-12-10-09-02.bpo-45855.MVsTDj.rst
@@ -0,0 +1,2 @@
+Document that the *no_block* argument to :c:func:`PyCapsule_Import` is a
+no-op now.
diff --git a/Objects/capsule.c b/Objects/capsule.c
index 9c9dcf33f9f75..606e50e696113 100644
--- a/Objects/capsule.c
+++ b/Objects/capsule.c
@@ -214,13 +214,9 @@ PyCapsule_Import(const char *name, int no_block)
}
if (object == NULL) {
- if (no_block) {
- object = PyImport_ImportModule(trace);
- } else {
- object = PyImport_ImportModule(trace);
- if (!object) {
- PyErr_Format(PyExc_ImportError, "PyCapsule_Import could not import module \"%s\"", trace);
- }
+ object = PyImport_ImportModule(trace);
+ if (!object) {
+ PyErr_Format(PyExc_ImportError, "PyCapsule_Import could not import module \"%s\"", trace);
}
} else {
PyObject *object2 = PyObject_GetAttrString(object, trace);
More information about the Python-checkins
mailing list