No ValueError for large exponents?

enigmadude enigmadude at rock.com
Sun Sep 10 03:25:46 EDT 2006


Georg Brandl wrote:
> enigmadude wrote:
> > As many have heard, IronPython 1.0 was released. When I was looking
> > through the listed differences between CPython and IronPython, the
> > document mentioned that using large exponents such as 10 **
> > 735293857239475 will cause CPython to hang, whereas IronPython will
> > raise a ValueError.
>
> What message does that value error have?
>
> If it's a memory issue, the operation should raise MemoryError (at
> least in CPython).
>
> Georg

I haven't run IronPython yet, but the "Differences" document says that
IronPython would raise a ValueError. It wasn't any more specific than
that. As far as CPython, I didn't wait long enough for it to raise a
MemoryError if it was going to raise one at all. From a user point of
view, CPython appeared to hang for about one minute, slowly raising CPU
usage and RAM usage, before I finally decided to just kill the process.
I don't know whether or not it would have completed 5 minutes later or
whether it would hang indefinitely, I haven't tested it. Although I may
be overreacting, I would wonder about the ramifications of something
like this hanging the interpreter (possible vector for DOS attack on an
webapp server, or even the machine itself if it balloons RAM usage?).
I'm not trying to be a doomsayer or anything, but I just want to know
how CPython handles extreme cases like this.




More information about the Python-list mailing list