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). * Don't try declare that these things shouldn't be used (there is not much I can do about that now). * Do warn people that these things evolve with the language. * If changes do happen, try make them visible and give a clear description of what has changed.
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.