Message272050
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. |
|
Date |
User |
Action |
Args |
2016-08-05 18:09:59 | ammar2 | set | recipients:
+ ammar2, vstinner, SilentGhost, serhiy.storchaka, fcostantini |
2016-08-05 18:09:59 | ammar2 | set | messageid: <1470420599.68.0.767045507778.issue27695@psf.upfronthosting.co.za> |
2016-08-05 18:09:59 | ammar2 | link | issue27695 messages |
2016-08-05 18:09:59 | ammar2 | create | |
|