[issue27695] Compilation doesnt' end

Ammar Askar report at bugs.python.org
Fri Aug 5 14:09:59 EDT 2016


Ammar Askar added the comment:

Just in case anyone is wondering why this happens. The compiler's peephole optimizer will fold constant expressions like 

x = 5 + 5

into

x = 10

More specifically, this bit here: https://github.com/python/cpython/blob/0f21fe6155227d11dc02bd3ef3b061de4ecea445/Python/peephole.c#L240


I'd say the current behavior of the compilation taking a long time is fine since at runtime it would run the exact same "2 ** 12345678912345" expression and spend a long time/run out of memory.

However I'd say the fact that this happens so silently can be a "gotcha" in some very rare cases.

----------
nosy: +ammar2

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


More information about the Python-bugs-list mailing list