Author ncoghlan
Recipients Mark.Shannon, benjamin.peterson, brett.cannon, eitan.adler, flherne, georg.brandl, inada.naoki, lukasz.langa, mbussonn, minrk, ncoghlan, ned.deily, rhettinger, serhiy.storchaka, vstinner
Date 2018-05-27.03:21:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527391290.06.0.682650639539.issue32911@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-05-27 03:21:30ncoghlansetrecipients: + ncoghlan, brett.cannon, georg.brandl, rhettinger, vstinner, benjamin.peterson, ned.deily, inada.naoki, lukasz.langa, Mark.Shannon, serhiy.storchaka, eitan.adler, minrk, mbussonn, flherne
2018-05-27 03:21:30ncoghlansetmessageid: <1527391290.06.0.682650639539.issue32911@psf.upfronthosting.co.za>
2018-05-27 03:21:30ncoghlanlinkissue32911 messages
2018-05-27 03:21:29ncoghlancreate