mirror of
https://github.com/python/cpython.git
synced 2025-08-19 16:20:59 +00:00
[3.13] gh-135755: Document __future__.* and CO_* as proper Sphinx objects (GH-135980) (GH-136371)
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
* Turn the __future__ table to list-table.
This'll make it easier to add entries that need longer markup
* Semantic markup for __future__ feature descriptions.
* Document CO_* C macros.
(cherry picked from commit 2468aafe98
)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This commit is contained in:
parent
a32bd11cb0
commit
3b28cb0f3f
3 changed files with 110 additions and 34 deletions
|
@ -211,6 +211,67 @@ bound into a function.
|
|||
.. versionadded:: 3.12
|
||||
|
||||
|
||||
.. _c_codeobject_flags:
|
||||
|
||||
Code Object Flags
|
||||
-----------------
|
||||
|
||||
Code objects contain a bit-field of flags, which can be retrieved as the
|
||||
:attr:`~codeobject.co_flags` Python attribute (for example using
|
||||
:c:func:`PyObject_GetAttrString`), and set using a *flags* argument to
|
||||
:c:func:`PyUnstable_Code_New` and similar functions.
|
||||
|
||||
Flags whose names start with ``CO_FUTURE_`` correspond to features normally
|
||||
selectable by :ref:`future statements <future>`. These flags can be used in
|
||||
:c:member:`PyCompilerFlags.cf_flags`.
|
||||
Note that many ``CO_FUTURE_`` flags are mandatory in current versions of
|
||||
Python, and setting them has no effect.
|
||||
|
||||
The following flags are available.
|
||||
For their meaning, see the linked documentation of their Python equivalents.
|
||||
|
||||
|
||||
.. list-table::
|
||||
:widths: auto
|
||||
:header-rows: 1
|
||||
|
||||
* * Flag
|
||||
* Meaning
|
||||
* * .. c:macro:: CO_OPTIMIZED
|
||||
* :py:data:`inspect.CO_OPTIMIZED`
|
||||
* * .. c:macro:: CO_NEWLOCALS
|
||||
* :py:data:`inspect.CO_NEWLOCALS`
|
||||
* * .. c:macro:: CO_VARARGS
|
||||
* :py:data:`inspect.CO_VARARGS`
|
||||
* * .. c:macro:: CO_VARKEYWORDS
|
||||
* :py:data:`inspect.CO_VARKEYWORDS`
|
||||
* * .. c:macro:: CO_NESTED
|
||||
* :py:data:`inspect.CO_NESTED`
|
||||
* * .. c:macro:: CO_GENERATOR
|
||||
* :py:data:`inspect.CO_GENERATOR`
|
||||
* * .. c:macro:: CO_COROUTINE
|
||||
* :py:data:`inspect.CO_COROUTINE`
|
||||
* * .. c:macro:: CO_ITERABLE_COROUTINE
|
||||
* :py:data:`inspect.CO_ITERABLE_COROUTINE`
|
||||
* * .. c:macro:: CO_ASYNC_GENERATOR
|
||||
* :py:data:`inspect.CO_ASYNC_GENERATOR`
|
||||
|
||||
* * .. c:macro:: CO_FUTURE_DIVISION
|
||||
* no effect (:py:data:`__future__.division`)
|
||||
* * .. c:macro:: CO_FUTURE_ABSOLUTE_IMPORT
|
||||
* no effect (:py:data:`__future__.absolute_import`)
|
||||
* * .. c:macro:: CO_FUTURE_WITH_STATEMENT
|
||||
* no effect (:py:data:`__future__.with_statement`)
|
||||
* * .. c:macro:: CO_FUTURE_PRINT_FUNCTION
|
||||
* no effect (:py:data:`__future__.print_function`)
|
||||
* * .. c:macro:: CO_FUTURE_UNICODE_LITERALS
|
||||
* no effect (:py:data:`__future__.unicode_literals`)
|
||||
* * .. c:macro:: CO_FUTURE_GENERATOR_STOP
|
||||
* no effect (:py:data:`__future__.generator_stop`)
|
||||
* * .. c:macro:: CO_FUTURE_ANNOTATIONS
|
||||
* :py:data:`__future__.annotations`
|
||||
|
||||
|
||||
Extra information
|
||||
-----------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue