[Python-checkins] [3.8] bpo-37253: Document PyCompilerFlags.cf_feature_version (GH-14019) (GH-14038)

Victor Stinner webhook-mailer at python.org
Wed Jun 12 20:40:45 EDT 2019


https://github.com/python/cpython/commit/f9445a391e6a91103fbe88bff4d3adc07f526c73
commit: f9445a391e6a91103fbe88bff4d3adc07f526c73
branch: 3.8
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-06-13T02:40:41+02:00
summary:

[3.8] bpo-37253: Document PyCompilerFlags.cf_feature_version (GH-14019) (GH-14038)

* 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.

(cherry picked from commit 2c9b498759f4fc74da82a0a96d059d666fa73f16)

files:
M Doc/c-api/veryhigh.rst
M Doc/whatsnew/3.8.rst

diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
index 3fe0ae47aac3..e6704ddeca09 100644
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -388,11 +388,22 @@ the same library that the Python runtime is using.
 
    Whenever ``PyCompilerFlags *flags`` is *NULL*, :attr:`cf_flags` is treated as
    equal to ``0``, and any modification due to ``from __future__ import`` is
-   discarded.  ::
+   discarded.
 
-      struct PyCompilerFlags {
-          int cf_flags;
-      }
+   .. c:member:: int cf_flags
+
+      Compiler flags.
+
+   .. c:member:: int cf_feature_version
+
+      *cf_feature_version* is the minor Python version. It should be
+      initialized to ``PY_MINOR_VERSION``.
+
+      The field is ignored by default, it is used if and only if
+      ``PyCF_ONLY_AST`` flag is set in *cf_flags*.
+
+   .. versionchanged:: 3.8
+      Added *cf_feature_version* field.
 
 
 .. c:var:: int CO_FUTURE_DIVISION
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 7e5d2f1f2d02..9989a0917434 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -1293,6 +1293,11 @@ Changes in the Python API
 Changes in the C API
 --------------------
 
+* The :c:type:`PyCompilerFlags` structure gets a new *cf_feature_version*
+  field. It should be initialized to ``PY_MINOR_VERSION``. The field is ignored
+  by default, it is used if and only if ``PyCF_ONLY_AST`` flag is set in
+  *cf_flags*.
+
 * The :c:func:`PyEval_ReInitThreads` function has been removed from the C API.
   It should not be called explicitly: use :c:func:`PyOS_AfterFork_Child`
   instead.



More information about the Python-checkins mailing list