bpo-37253: Document PyCompilerFlags.cf_feature_version (GH-14019)
authorVictor Stinner <vstinner@redhat.com>
Thu, 13 Jun 2019 00:01:29 +0000 (02:01 +0200)
committerGitHub <noreply@github.com>
Thu, 13 Jun 2019 00:01:29 +0000 (02:01 +0200)
* 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.

Doc/c-api/veryhigh.rst
Doc/whatsnew/3.8.rst

index 3fe0ae47aac35a852bf562f7ca3ae3b986aa9539..835afcb4f217f6ce82e5a3c8577d0fe861490983 100644 (file)
@@ -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
index 264586434b9b0866c54b24f1e66c28767329c23b..3e607130743df15e337e0530a163c52878247ca0 100644 (file)
@@ -1312,6 +1312,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.