New submission from STINNER Victor <vstin...@redhat.com>:
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: https://docs.python.org/dev/c-api/veryhigh.html#c.PyCompilerFlags 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 https://docs.python.org/dev/whatsnew/3.8.html#changes-in-the-c-api 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? ---------- components: Interpreter Core messages: 345368 nosy: vstinner priority: normal severity: normal status: open title: PyCompilerFlags got a new cf_feature_version field versions: Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37253> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com