[issue11105] Compiling evil ast crashes interpreter

Benjamin Peterson report at bugs.python.org
Thu Feb 3 18:28:07 CET 2011


Benjamin Peterson <benjamin at python.org> added the comment:

2011/2/3 Alexander Belopolsky <report at bugs.python.org>:
>
> 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.

Other people are, though. The hash is by identity anyway.

----------

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


More information about the Python-bugs-list mailing list