[3.12] gh-101100: Improve documentation of code object attributes (#112781) (#112816)

(cherry-picked from commit e9707d3c3d)
This commit is contained in:
Alex Waygood 2023-12-06 22:11:53 +00:00 committed by GitHub
parent af7cf385a2
commit ca11aec98c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 109 additions and 51 deletions

View file

@ -37,7 +37,7 @@ There are a few functions specific to Python functions.
The function's docstring and name are retrieved from the code object. *__module__*
is retrieved from *globals*. The argument defaults, annotations and closure are
set to ``NULL``. *__qualname__* is set to the same value as the code object's
``co_qualname`` field.
:attr:`~codeobject.co_qualname` field.
.. c:function:: PyObject* PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
@ -45,7 +45,7 @@ There are a few functions specific to Python functions.
As :c:func:`PyFunction_New`, but also allows setting the function object's
``__qualname__`` attribute. *qualname* should be a unicode object or ``NULL``;
if ``NULL``, the ``__qualname__`` attribute is set to the same value as the
code object's ``co_qualname`` field.
code object's :attr:`~codeobject.co_qualname` field.
.. versionadded:: 3.3

View file

@ -138,7 +138,7 @@ Importing Modules
:class:`~importlib.machinery.SourceFileLoader` otherwise.
The module's :attr:`__file__` attribute will be set to the code object's
:attr:`!co_filename`. If applicable, :attr:`__cached__` will also
:attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also
be set.
This function will reload the module if it was already imported. See