diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-03-04 12:57:09 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-03-04 12:57:09 (GMT) |
commit | 27ee089c35144fe1350f5f411051d5d3ecb88b6c (patch) | |
tree | daab0428b722f5f639f0de24b9a64d7d2222465c /Doc/c-api/import.rst | |
parent | 0639b56672112e69a1d55c0105dae9198f757ec2 (diff) | |
download | cpython-27ee089c35144fe1350f5f411051d5d3ecb88b6c.zip cpython-27ee089c35144fe1350f5f411051d5d3ecb88b6c.tar.gz cpython-27ee089c35144fe1350f5f411051d5d3ecb88b6c.tar.bz2 |
Issue #3080: Add PyImport_AddModuleObject() and PyImport_ExecCodeModuleObject()
Diffstat (limited to 'Doc/c-api/import.rst')
-rw-r--r-- | Doc/c-api/import.rst | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index cf48363..bcf5def 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -86,7 +86,7 @@ Importing Modules an exception set on failure (the module still exists in this case). -.. c:function:: PyObject* PyImport_AddModule(const char *name) +.. c:function:: PyObject* PyImport_AddModuleObject(PyObject *name) Return the module object corresponding to a module name. The *name* argument may be of the form ``package.module``. First check the modules dictionary if @@ -100,6 +100,14 @@ Importing Modules or one of its variants to import a module. Package structures implied by a dotted name for *name* are not created if not already present. + .. versionadded:: 3.3 + + +.. c:function:: PyObject* PyImport_AddModule(const char *name) + + Similar to :c:func:`PyImport_AddModuleObject`, but the name is an UTF-8 + encoded string instead of a Unicode object. + .. c:function:: PyObject* PyImport_ExecCodeModule(char *name, PyObject *co) @@ -136,14 +144,23 @@ Importing Modules See also :c:func:`PyImport_ExecCodeModuleWithPathnames`. -.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname, char *cpathname) +.. c:function:: PyObject* PyImport_ExecCodeModuleObject(PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname) Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__` attribute of the module object is set to *cpathname* if it is non-``NULL``. Of the three functions, this is the preferred one to use. + .. versionadded:: 3.3 + + +.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname, char *cpathname) + + Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and + *cpathname* are UTF-8 encoded strings. + .. versionadded:: 3.2 + .. c:function:: long PyImport_GetMagicNumber() Return the magic number for Python bytecode files (a.k.a. :file:`.pyc` and |