Message272050
| Author |
ammar2 |
| Recipients |
SilentGhost, ammar2, fcostantini, serhiy.storchaka, vstinner |
| Date |
2016年08月05日.18:09:59 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1470420599.68.0.767045507778.issue27695@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|