From: Inada Naoki Date: Thu, 24 Apr 2025 14:05:56 +0000 (+0900) Subject: doc: update co_flags reference (#132300) X-Git-Tag: v3.14.0b1~330 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b1f2304b206c4db0ad6531f254d5bd60a2d605d9;p=thirdparty%2FPython%2Fcpython.git doc: update co_flags reference (#132300) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index f1b7d33655c5..b3096a9f0c38 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1526,18 +1526,17 @@ positional arguments; bit ``0x08`` is set if the function uses the if the function is a generator. See :ref:`inspect-module-co-flags` for details on the semantics of each flags that might be present. -Future feature declarations (``from __future__ import division``) also use bits +Future feature declarations (for example, ``from __future__ import division``) also use bits in :attr:`~codeobject.co_flags` to indicate whether a code object was compiled with a -particular feature enabled: bit ``0x2000`` is set if the function was compiled -with future division enabled; bits ``0x10`` and ``0x1000`` were used in earlier -versions of Python. +particular feature enabled. See :attr:`~__future__._Feature.compiler_flag`. Other bits in :attr:`~codeobject.co_flags` are reserved for internal use. .. index:: single: documentation string If a code object represents a function and has a docstring, -the first item in :attr:`~codeobject.co_consts` is +the :data:`~inspect.CO_HAS_DOCSTRING` bit is set in :attr:`~codeobject.co_flags` +and the first item in :attr:`~codeobject.co_consts` is the docstring of the function. Methods on code objects