summaryrefslogtreecommitdiff
path: root/astroid
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2021-05-15 16:59:37 -0300
committerGitHub <noreply@github.com>2021-05-15 21:59:37 +0200
commit962becc0ae86c16f7b33140f43cd6ed8f1e8a045 (patch)
tree3f3290047e4b431bd7035b91aa6ad414c882b347 /astroid
parentd19758108727e1fd11e343d857d060d4f80655d1 (diff)
downloadastroid-git-962becc0ae86c16f7b33140f43cd6ed8f1e8a045.tar.gz
Add kind field to Const (#943)
Diffstat (limited to 'astroid')
-rw-r--r--astroid/node_classes.py10
-rw-r--r--astroid/rebuilder.py2
2 files changed, 7 insertions, 5 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py
index 7faf6812..f8d0b23c 100644
--- a/astroid/node_classes.py
+++ b/astroid/node_classes.py
@@ -2557,7 +2557,7 @@ class Const(mixins.NoChildrenMixin, NodeNG, bases.Instance):
_other_fields = ("value",)
- def __init__(self, value, lineno=None, col_offset=None, parent=None):
+ def __init__(self, value, lineno=None, col_offset=None, parent=None, kind=None):
"""
:param value: The value that the constant represents.
:type value: object
@@ -2571,12 +2571,12 @@ class Const(mixins.NoChildrenMixin, NodeNG, bases.Instance):
:param parent: The parent node in the syntax tree.
:type parent: NodeNG or None
- """
- self.value = value
- """The value that the constant represents.
- :type: object
+ :param kind: The string prefix. "u" for u-prefixed strings and ``None`` otherwise. Python 3.8+ only.
+ :type kind: str or None
"""
+ self.value = value
+ self.kind = kind
super().__init__(lineno, col_offset, parent)
diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py
index bb6a23b8..2532b61d 100644
--- a/astroid/rebuilder.py
+++ b/astroid/rebuilder.py
@@ -425,6 +425,7 @@ class TreeRebuilder:
getattr(node, "lineno", None),
getattr(node, "col_offset", None),
parent,
+ getattr(node, "kind", None),
)
def visit_continue(self, node, parent):
@@ -814,6 +815,7 @@ class TreeRebuilder:
getattr(node, "lineno", None),
getattr(node, "col_offset", None),
parent,
+ getattr(node, "kind", None),
)
# Not used in Python 3.8+.