bpo-36280: Add Constant.kind field#12295
Conversation
The value is a string for string and byte literals, None otherwise. It's 'u' for u... literals, 'b' for b... literals, '' for ... literals.
|
Do you need indications for triple-quote strings? Why do you need 'b' for bytes if you can use What kind should be for concatenated '' and u'' literals? E.g.: |
Not for this use case.
Good point. (I believe I was just copying that behavior from the Python 2 part of typed_ast, where it was considered useful.)
For my use case it doesn't really matter; I'd rather not waste time trying to do something smarter than looking for the first segment. Here's what I propose to do. I'll set it to Sadly none of that helps me fixing the unit tests -- I believe the problems are all caused by the changes to the |
|
@gvanrossum: Status check is done, and it's a success ✅ . |
|
Sorry, I can't merge this PR. Reason: |
To test with Python 3.8, this requires python/cpython#12295. The typeshed changes were in python/typeshed#2859 (and synced in #6540).
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