471,353 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,353 software developers and data experts.

No ValueError for large exponents?

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. Trying this on my own machine, it did indeed seem
to cause CPython to hang. In cases such as this, should this be
considered a bug in the CPython implementation that needs to be fixed?
Or is there a reason for this, such as consideration of future changes
and language definition vs language implementation, etc.?

Sep 6 '06 #1
4 1722
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. Trying this on my own machine, it did indeed seem
to cause CPython to hang. In cases such as this, should this be
considered a bug in the CPython implementation that needs to be fixed?
Or is there a reason for this, such as consideration of future changes
and language definition vs language implementation, etc.?
I suspect the hang may be python actually trying to work out the
1 followed by 735293857239475 zeroes. Perhaps IronPython has a forward
looking algorithm that knows when to give up early.
--
Robin Becker
Sep 6 '06 #2
Robin Becker <ro***@NOSPAMreportlab.comwrote:
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. Trying this on my own machine, it did indeed seem
to cause CPython to hang. In cases such as this, should this be
considered a bug in the CPython implementation that needs to be fixed?
Or is there a reason for this, such as consideration of future changes
and language definition vs language implementation, etc.?
I suspect the hang may be python actually trying to work out the
1 followed by 735293857239475 zeroes. Perhaps IronPython has a forward
looking algorithm that knows when to give up early.
My guess would be that IronPython preallocates sufficient memory for the
resulting string, so will fail immediately, and CPython must be trying to
grow the string dynamically.
Sep 7 '06 #3
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
Sep 7 '06 #4
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.

Sep 10 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Aki Niimura | last post: by
1 post views Thread by Tom McCallum | last post: by
5 posts views Thread by Todd Steury | last post: by
16 posts views Thread by raj | last post: by
2 posts views Thread by Stefan L | last post: by
reply views Thread by Chris Fonnesbeck | last post: by
1 post views Thread by alain MONTMORY | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.