Nick Coghlan <ncogh...@gmail.com> added the comment:

Just noting that I'm going to attempt an alternative, hopefully lower impact, 
approach at implementing the reversion, which will be to modify 
Parser/asdl_c.py to inject the following constructor postamble for ASDL nodes 
that define both a "body" and a "docstring" field:

1. If docstring is set, also insert it as the first entry in the node's body 
sequence (this is enough to get AST compilation back to behaving the way it did 
in 3.6, since the docstrings will be reinserted as `body[0]` even after the AST 
compilation process took them out)
2. If docstring is not set, check if the first entry is usable as a docstring, 
and if so, also set it as the docstring (this would restore compatibility with 
node manipulation code that expects to be able to pass a docstring as body[0])

In 3.8, we'd then decide how to eliminate the duplication of information 
between the two locations, but do so armed with the ability to emit deprecation 
warnings for code which isn't setting the node docstring attribute explicitly.

----------

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

Reply via email to