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 BTaskaya
Recipients BTaskaya
Date 2019-10-07.15:55:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1570463756.86.0.131436803473.issue38396@roundup.psfhosted.org>
In-reply-to
Content
def _convert_num(node):
        if isinstance(node, Constant):
            if type(node.value) in (int, float, complex):
                return node.value
>       raise ValueError('malformed node or string: ' + repr(node))
E       ValueError: malformed node or string: <_ast.Name object at 0x7f0e7ebab320>

When a malformed node passes into literal_eval, it raises ValueError with repr of node (which is just a memory address and type). I think using dump(node) at there is a better option, like

node = <_ast.Name object at 0x7fa8279847d0>

    def _convert_num(node):
        if isinstance(node, Constant):
            if type(node.value) in (int, float, complex):
                return node.value
>       raise ValueError('malformed node or string: ' + dump(node))
E       ValueError: malformed node or string: Name(id='a', ctx=Load())
History
Date User Action Args
2019-10-07 15:55:56BTaskayasetrecipients: + BTaskaya
2019-10-07 15:55:56BTaskayasetmessageid: <1570463756.86.0.131436803473.issue38396@roundup.psfhosted.org>
2019-10-07 15:55:56BTaskayalinkissue38396 messages
2019-10-07 15:55:56BTaskayacreate