This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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.
History
Date User Action Args
2016-08-05 18:09:59ammar2setrecipients: + ammar2, vstinner, SilentGhost, serhiy.storchaka, fcostantini
2016-08-05 18:09:59ammar2setmessageid: <1470420599.68.0.767045507778.issue27695@psf.upfronthosting.co.za>
2016-08-05 18:09:59ammar2linkissue27695 messages
2016-08-05 18:09:59ammar2create