]> granicus.if.org Git - python/commit
bpo-36280: Add Constant.kind field (GH-12295)
authorGuido van Rossum <guido@python.org>
Wed, 13 Mar 2019 20:00:46 +0000 (13:00 -0700)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 13 Mar 2019 20:00:46 +0000 (13:00 -0700)
commit10f8ce66884cd7fee2372b8dae08ca8132091574
treea303475519567ad973a7a961c61f613c90003d3a
parent8b5bdda5b4c418c4a858f183763d0a497170977c
bpo-36280: Add Constant.kind field (GH-12295)

The value is a string for string and byte literals, None otherwise.
It is 'u' for u"..." literals, 'b' for b"..." literals, '' for "..." literals.
The 'r' (raw) prefix is ignored.
Does not apply to f-strings.

This appears sufficient to make mypy capable of using the stdlib ast module instead of typed_ast (assuming a mypy patch I'm working on).

WIP: I need to make the tests pass. @ilevkivskyi @serhiy-storchaka

https://bugs.python.org/issue36280
Include/Python-ast.h
Lib/test/test_ast.py
Misc/NEWS.d/next/Library/2019-03-12-21-02-55.bpo-36280.mOd3iH.rst [new file with mode: 0644]
Parser/Python.asdl
Python/Python-ast.c
Python/ast.c