[Python-Dev] Expected stability of PyCode_New() and types.CodeType() signatures

Terry Reedy tjreedy at udel.edu
Fri May 31 18:29:10 EDT 2019

On 5/31/2019 5:28 PM, Simon Cross wrote:
> As the maintainer of Genshi, one the libraries affected by the CodeType 
> and similar changes, I thought I could add a users perspective to the 
> discussion:
> Genshi is a templating engine that parses Python code from inside its 
> templates. It supports Python 2.6+, 3.2+, pypy2 and pypy3. It parses 
> Python using compile(...) and then walks the AST to, for example, 
> translate variable lookups into template context lookups.
> Pretty much every major release of Python has broken Genshi's Python 
> parsing in some way. While on the one hand this is a bit annoying, I 
> also don't want Python to stop evolving where it makes sense.
> My requests to core developers are largely pragmatic:
> * Try not to change things unless there's a good reason to (i.e. it 
> makes Python better).

We try not to.  There is already too much work.

> * Don't try declare that these things shouldn't be used (there is not 
> much I can do about that now).

That was removed from the PR before it was merged.

> * Do warn people that these things evolve with the language.

That was merged.

> * If changes do happen, try make them visible and give a clear 
> description of what has changed.

Another chunk was added to What's New.

> Also many thanks to the core developers who've submitted patches to 
> update Genshi in the past -- that was awesome of you.
> The new CodeType.replace will remove some potential sources of breakages 
> in the future, so thank you very much for adding that.

Terry Jan Reedy

More information about the Python-Dev mailing list