Stefan Behnel <stefan...@behnel.de> added the comment:

I was made aware [1] that the addition of the "cf_feature_version" field broke 
the backwards compatibility of the "PyRun_StringFlags()" function [2]. Unlike 
what the docs of "PyCompilerFlags" [3] suggest, the new field is not ignored 
there but must now be set in order to enable the syntax features of the running 
Python version.

Background: A Cython user was trying "exec()" on code with f-strings in Py3.8 
and got a SyntaxError, because "cf_feature_version" had not been initialised.

I can see two types of existing code being affected:

1) applications or modules that execute user provided Python code (as in the 
bug report) for which users expect the syntax of the currently running Python 
runtime to be available.

2) code that used to work in Py3.6/7 using the available Python syntax features 
and now runs into newly introduced syntax restrictions in Py3.8, such as 
f-strings no longer being available.

Since Py3.8 has been out for a while with this change, and there were 
apparently little complaints in addition to issue 37072, should we just update 
the documentation of "PyCompilerFlags" and "PyRun_StringFlags()" to mention the 
change there?

[1] https://github.com/cython/cython/issues/3695
[2] https://docs.python.org/3/c-api/veryhigh.html#c.PyRun_StringFlags
[3] https://docs.python.org/3/c-api/veryhigh.html#c.PyCompilerFlags

----------
nosy: +scoder

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35975>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to