New submission from Brandt Bucher <brandtbuc...@gmail.com>:

There are several places in the ast module where the use of zip is allowing 
malformed nodes to have unpaired children silently thrown away. A couple of 
short examples:

>>> from ast import Constant, Dict, literal_eval, unparse
>>> nasty_dict = Dict(keys=[Constant("I don't have a value!")], values=[])
>>> unparse(nasty_dict)
'{}'
>>> literal_eval(nasty_dict)
{}

I'm currently working on a patch to raise errors instead.

----------
assignee: brandtbucher
components: Library (Lib)
messages: 366938
nosy: brandtbucher
priority: normal
severity: normal
status: open
title: The ast module fails to reject certain malformed nodes
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40355>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to