diff options
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/newtypes.rst | 2 | ||||
-rw-r--r-- | Doc/c-api/utilities.rst | 20 |
2 files changed, 7 insertions, 15 deletions
diff --git a/Doc/c-api/newtypes.rst b/Doc/c-api/newtypes.rst index 88a4f2f..8c72ef1 100644 --- a/Doc/c-api/newtypes.rst +++ b/Doc/c-api/newtypes.rst @@ -729,7 +729,7 @@ type objects) *must* have the :attr:`ob_size` field. indicated by the :const:`Py_TPFLAGS_HAVE_RICHCOMPARE` flag bit) and have *NULL* values. - The following bit masks are currently defined; these can be or-ed together using + The following bit masks are currently defined; these can be ORed together using the ``|`` operator to form the value of the :attr:`tp_flags` field. The macro :cfunc:`PyType_HasFeature` takes a type and a flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-zero. diff --git a/Doc/c-api/utilities.rst b/Doc/c-api/utilities.rst index c4c4b7e..c30a62a 100644 --- a/Doc/c-api/utilities.rst +++ b/Doc/c-api/utilities.rst @@ -197,19 +197,14 @@ Importing Modules to find out. Starting with Python 2.4, a failing import of a module no longer leaves the module in ``sys.modules``. - .. index:: single: modules (in module sys) - .. cfunction:: PyObject* PyImport_ImportModuleNoBlock(const char *name) - .. index:: - single: `cfunc:PyImport_ImportModule` - - This version of `cfunc:PyImport_ImportModule` does not block. It's intended + This version of :cfunc:`PyImport_ImportModule` does not block. It's intended to be used in C function which import other modules to execute a function. The import may block if another thread holds the import lock. The function - `cfunc:PyImport_ImportModuleNoBlock` doesn't block. It first tries to fetch - the module from sys.modules and falls back to `cfunc:PyImport_ImportModule` + :cfunc:`PyImport_ImportModuleNoBlock` doesn't block. It first tries to fetch + the module from sys.modules and falls back to :cfunc:`PyImport_ImportModule` unless the the lock is hold. In the latter case the function raises an ImportError. @@ -231,9 +226,6 @@ Importing Modules Failing imports remove incomplete module objects, like with :cfunc:`PyImport_ImportModule`. - The function is an alias for `cfunc:PyImport_ImportModuleLevel` with -1 as - *level*, meaning relative import. - .. cfunction:: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) @@ -286,9 +278,9 @@ Importing Modules :func:`compile`, load the module. Return a new reference to the module object, or *NULL* with an exception set if an error occurred. Before Python 2.4, the module could still be created in error cases. Starting with Python 2.4, *name* - is removed from ``sys.modules`` in error cases, and even if *name* was already - in ``sys.modules`` on entry to :cfunc:`PyImport_ExecCodeModule`. Leaving - incompletely initialized modules in ``sys.modules`` is dangerous, as imports of + is removed from :attr:`sys.modules` in error cases, and even if *name* was already + in :attr:`sys.modules` on entry to :cfunc:`PyImport_ExecCodeModule`. Leaving + incompletely initialized modules in :attr:`sys.modules` is dangerous, as imports of such modules have no way to know that the module object is an unknown (and probably damaged with respect to the module author's intents) state. |