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.

classification
Title: Add kind field to ast.Constant, to distinguish u"..." from "..." for type checkers
Type: behavior Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-03-13 04:00 by gvanrossum, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12295 merged gvanrossum, 2019-03-13 04:00
Messages (5)
msg337834 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-13 04:16
Maybe use a special subclass of Constant for indicating string literals with the "u" prefix?
msg337853 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2019-03-13 14:52
> Maybe use a special subclass of Constant for indicating string literals with the "u" prefix?

That would indeed be more convenient, as it requires fewer code and test changes. Are there examples of such classes in Python.asdl?
msg337854 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2019-03-13 15:11
On second thought, even though it's a subclass, it feels less consistent than an extra attribute. So I'd rather keep the current approach (kind -> 'u' or None).
msg337872 - (view) Author: miss-islington (miss-islington) Date: 2019-03-13 20:00
New changeset 10f8ce66884cd7fee2372b8dae08ca8132091574 by Miss Islington (bot) (Guido van Rossum) in branch 'master':
bpo-36280: Add Constant.kind field (GH-12295)
https://github.com/python/cpython/commit/10f8ce66884cd7fee2372b8dae08ca8132091574
msg337873 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2019-03-13 20:01
Thanks for the review Serhiy!
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80461
2019-03-13 20:01:54gvanrossumsetstatus: open -> closed
resolution: fixed
messages: + msg337873

stage: patch review -> resolved
2019-03-13 20:00:50miss-islingtonsetnosy: + miss-islington
messages: + msg337872
2019-03-13 15:11:20gvanrossumsetmessages: + msg337854
2019-03-13 14:52:11gvanrossumsetmessages: + msg337853
2019-03-13 04:16:19serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg337834
2019-03-13 04:00:38gvanrossumsetkeywords: + patch
stage: patch review
pull_requests: + pull_request12279
2019-03-13 04:00:08gvanrossumcreate