This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Valentin.Lorentz
Recipients Valentin.Lorentz, methane
Date 2017-02-25.10:11:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488017474.82.0.510705451236.issue29646@psf.upfronthosting.co.za>
In-reply-to
Content
Since commit cb41b2766de646435743b6af7dd152751b54e73f (Python 3.7a0), string literals are not parsed the same way.

ast.parse("'test'").body used to be a list with one item containing 'test'; but now it is an empty list:


Python 3.5.2+ (default, Dec 13 2016, 14:16:35) 
[GCC 6.2.1 20161124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> print(ast.parse("'test'"))
<_ast.Module object at 0x7fa37ae4c630>
>>> print(ast.parse("'test'").body)
[<_ast.Expr object at 0x7fa37ae4c630>]
>>> print(ast.parse("'test'").docstring)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Module' object has no attribute 'docstring'





Python 3.7.0a0 (default, Feb 24 2017, 21:38:30) 
[GCC 6.3.0 20170205] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> print(ast.parse("'test'"))
<_ast.Module object at 0x7fe2aa415eb8>
>>> print(ast.parse("'test'").body)
[]
>>> print(ast.parse("'test'").docstring)
test
History
Date User Action Args
2017-02-25 10:11:14Valentin.Lorentzsetrecipients: + Valentin.Lorentz, methane
2017-02-25 10:11:14Valentin.Lorentzsetmessageid: <1488017474.82.0.510705451236.issue29646@psf.upfronthosting.co.za>
2017-02-25 10:11:14Valentin.Lorentzlinkissue29646 messages
2017-02-25 10:11:14Valentin.Lorentzcreate