@@ -98,27 +98,46 @@ 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.
111+
112+ The module name *name * is decoded from UTF-8.
113+
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.
102119
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.
120+ .. versionadded :: 3.13
107121
108- .. note ::
109122
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 .
123+ .. c : function :: PyObject* PyImport_AddModuleObject (PyObject * name)
124+
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
130+ .. deprecated-removed :: 3.13 3.15
131+ Use :c:func: `PyImport_AddModuleRef ` instead.
132+
117133
118134.. c :function :: PyObject* PyImport_AddModule (const char *name)
119135
120- Similar to :c:func: `PyImport_AddModuleObject `, but the name is a UTF-8
121- encoded string instead of a Unicode object.
136+ Similar to :c:func: `PyImport_AddModuleRef `, but return a :term: `borrowed
137+ reference `.
138+
139+ .. deprecated-removed :: 3.13 3.15
140+ Use :c:func: `PyImport_AddModuleRef ` instead.
122141
123142
124143.. c :function :: PyObject* PyImport_ExecCodeModule (const char *name, PyObject *co)
0 commit comments