This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2019-06-12.15:15:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The commit dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c of bpo-35766 added a new cf_feature_version field to PyCompilerFlags. Each PyCompilerFlags variable must properly initialize this new field to PY_MINOR_VERSION. I propose to add a new _PyCompilerFlags_INIT macro to statically initialize such variable. I'm not sure if it should be public or not.

The PyCompilerFlags structure is excluded from the stable ABI (PEP 384), but it's documented in the "The Very High Level Layer" C API documentation:

Structure fields are documented there:

struct PyCompilerFlags {
    int cf_flags;

The doc is outdated. I'm not sure if it's on purpose or not.

Moreover, the new PyCompilerFlags.cf_feature_version field is not documented in whereas C extensions using PyCompilerFlags should initialize cf_feature_version to PY_MINOR_VERSION?

I'm not sure if C extensions really *must* initialize cf_feature_version, since the field is only used if PyCF_ONLY_AST flag is set in the cf_flags field.

Something else, ast.parse() has been modified to use a (major, minor) version tuple rather an integer to specify the Python version in feature_version, but PyCompilerFlags still only uses the minor major. This API will be broken once the Python major version will be increased to 4, no? Would it make sense to use PY_VERSION_HEX format which includes the major version instead?

Or cf_feature_version could be a structure with major and minor fields, but that might be overkill?
Date User Action Args
2019-06-12 15:15:01vstinnersetrecipients: + vstinner
2019-06-12 15:15:01vstinnersetmessageid: <>
2019-06-12 15:15:01vstinnerlinkissue37253 messages
2019-06-12 15:15:01vstinnercreate