Skip to content

Commit 2c9b498

Browse files
authored
bpo-37253: Document PyCompilerFlags.cf_feature_version (pythonGH-14019)
* Update PyCompilerFlags structure documentation. * Document the new cf_feature_version field in the Changes in the C API section of the What's New in Python 3.8 doc.
1 parent 468e5fe commit 2c9b498

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Doc/c-api/veryhigh.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,22 @@ the same library that the Python runtime is using.
388388
389389
Whenever ``PyCompilerFlags *flags`` is *NULL*, :attr:`cf_flags` is treated as
390390
equal to ``0``, and any modification due to ``from __future__ import`` is
391-
discarded. ::
391+
discarded.
392392
393-
struct PyCompilerFlags {
394-
int cf_flags;
395-
}
393+
.. c:member:: int cf_flags
394+
395+
Compiler flags.
396+
397+
.. c:member:: int cf_feature_version;
398+
399+
*cf_feature_version* is the minor Python version. It should be
400+
initialized to ``PY_MINOR_VERSION``.
401+
402+
The field is ignored by default, it is used if and only if
403+
``PyCF_ONLY_AST`` flag is set in *cf_flags*.
404+
405+
.. versionchanged:: 3.8
406+
Added *cf_feature_version* field.
396407
397408
398409
.. c:var:: int CO_FUTURE_DIVISION

Doc/whatsnew/3.8.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,11 @@ Changes in the Python API
13121312
Changes in the C API
13131313
--------------------
13141314

1315+
* The :c:type:`PyCompilerFlags` structure gets a new *cf_feature_version*
1316+
field. It should be initialized to ``PY_MINOR_VERSION``. The field is ignored
1317+
by default, it is used if and only if ``PyCF_ONLY_AST`` flag is set in
1318+
*cf_flags*.
1319+
13151320
* The :c:func:`PyEval_ReInitThreads` function has been removed from the C API.
13161321
It should not be called explicitly: use :c:func:`PyOS_AfterFork_Child`
13171322
instead.

0 commit comments

Comments
 (0)