[issue11105] Compiling evil ast crashes interpreter

Alexander Belopolsky report at bugs.python.org
Thu Feb 3 18:21:43 CET 2011


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Thu, Feb 3, 2011 at 12:08 PM, Benjamin Peterson
<report at bugs.python.org> wrote:
..
>> I wonder: Why ast nodes need to be mutable?
>
> So people can change them.

Well, they are hashable, so this needs to be done carefully.  Is this
necessary for AST-based optimizations?  Does Python actually change
AST after it has been created?  Note that for some optimizations it
may be more appropriate to build a new tree rather than mutate the old
one.  Depending on the algorithm, you may or may not need to change
the nodes after they have been created in the process.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11105>
_______________________________________


More information about the Python-bugs-list mailing list