Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4095e5

Browse files
authored
bpo-45855: document that no_block has no use anymore in PyCapsule_Import (#29665)
1 parent f3c16a5 commit f4095e5

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

Doc/c-api/capsule.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ Refer to :ref:`using-capsules` for more information on using these objects.
103103
Import a pointer to a C object from a capsule attribute in a module. The
104104
*name* parameter should specify the full name to the attribute, as in
105105
``module.attribute``. The *name* stored in the capsule must match this
106-
string exactly. If *no_block* is true, import the module without blocking
107-
(using :c:func:`PyImport_ImportModuleNoBlock`). If *no_block* is false,
108-
import the module conventionally (using :c:func:`PyImport_ImportModule`).
106+
string exactly.
109107
110108
Return the capsule's internal *pointer* on success. On failure, set an
111109
exception and return ``NULL``.
112110
111+
.. versionchanged:: 3.3
112+
*no_block* has no effect anymore.
113+
113114
114115
.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
115116
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Document that the *no_block* argument to :c:func:`PyCapsule_Import` is a
2+
no-op now.

Objects/capsule.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,9 @@ PyCapsule_Import(const char *name, int no_block)
214214
}
215215

216216
if (object == NULL) {
217-
if (no_block) {
218-
object = PyImport_ImportModule(trace);
219-
} else {
220-
object = PyImport_ImportModule(trace);
221-
if (!object) {
222-
PyErr_Format(PyExc_ImportError, "PyCapsule_Import could not import module \"%s\"", trace);
223-
}
217+
object = PyImport_ImportModule(trace);
218+
if (!object) {
219+
PyErr_Format(PyExc_ImportError, "PyCapsule_Import could not import module \"%s\"", trace);
224220
}
225221
} else {
226222
PyObject *object2 = PyObject_GetAttrString(object, trace);

0 commit comments

Comments
 (0)