@@ -98,27 +98,40 @@ Importing Modules
9898 an exception set on failure (the module still exists in this case).
9999
100100
101- .. c:function:: PyObject* PyImport_AddModuleObject(PyObject *name)
101+ .. c:function:: PyObject* PyImport_AddModuleRef(const char *name)
102+
103+ Return the module object corresponding to a module name.
104+
105+ The *name * argument may be of the form ``package.module ``. First check the
106+ modules dictionary if there's one there, and if not, create a new one and
107+ insert it in the modules dictionary.
108+
109+ Return a :term: `strong reference ` to the module on success. Return ``NULL ``
110+ with an exception set on failure.
102111
103- Return the module object corresponding to a module name. The *name * argument
104- may be of the form ``package.module ``. First check the modules dictionary if
105- there's one there, and if not, create a new one and insert it in the modules
106- dictionary. Return ``NULL `` with an exception set on failure.
112+ The module name *name * is decoded from UTF-8.
107113
108- .. note ::
114+ This function does not load or import the module; if the module wasn't
115+ already loaded, you will get an empty module object. Use
116+ :c:func: `PyImport_ImportModule ` or one of its variants to import a module.
117+ Package structures implied by a dotted name for *name * are not created if
118+ not already present.
119+
120+ .. versionadded :: 3.13
121+
122+
123+ .. c :function :: PyObject* PyImport_AddModuleObject (PyObject *name)
109124
110- This function does not load or import the module; if the module wasn't already
111- loaded, you will get an empty module object. Use :c:func: `PyImport_ImportModule `
112- or one of its variants to import a module. Package structures implied by a
113- dotted name for *name * are not created if not already present.
125+ Similar to :c:func: `PyImport_AddModuleRef `, but return a :term: `borrowed
126+ reference ` and *name * is a Python :class: `str ` object.
114127
115128 .. versionadded :: 3.3
116129
117130
118131.. c :function :: PyObject* PyImport_AddModule (const char *name)
119132
120- Similar to :c:func: `PyImport_AddModuleObject `, but the name is a UTF-8
121- encoded string instead of a Unicode object .
133+ Similar to :c:func: `PyImport_AddModuleRef `, but return a :term: ` borrowed
134+ reference ` .
122135
123136
124137.. c :function :: PyObject* PyImport_ExecCodeModule (const char *name, PyObject *co)
0 commit comments