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 <rep...@bugs.python.org>
<http://bugs.python.org/issue27695>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to