[Patches] [ python-Patches-719359 ] fix test_long failure on OSF/1

SourceForge.net noreply@sourceforge.net
Sun, 25 May 2003 09:40:53 -0700


Patches item #719359, was opened at 2003-04-10 19:15
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=719359&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
>Assigned to: Martin v. Löwis (loewis)
Summary: fix test_long failure on OSF/1

Initial Comment:
When using cc on OSF/1 V5.1, test_long fails because
PyFloat_FromString() returns a ValueError instead of an
OverflowError when the string is too long.  The library
appears to work a bit different.  This patch fixes the
problem.

test test_long crashed -- exceptions.ValueError:
invalid literal for float():
12345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-25 12:40

Message:
Logged In: YES 
user_id=33168

You're right.  I've attached a patch which fixes the
compiler options.  No code changes were necessary.  

This new patch seems to fix a number of problems.  It adds 3
options to pass to cc:  -ieee to fix test_long and SIGFPEs,
-std to get a reasonable assert on some versions of
Tru64/OSF, -pthread to support threads.  The options are
only added for cc.  I do not have access to gcc.  Hopefully
others can test that everything works with gcc (it's
unchanged in this patch).

Martin, could you please review this.  I will try to get all
the original bug submitters to test this patch.

Related issues:
 * http://python.org/sf/693094
 * http://python.org/sf/738066
 * http://python.org/sf/741307
 * http://python.org/sf/741806
 * http://python.org/sf/719359 (this patch)


----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-05-25 11:19

Message:
Logged In: YES 
user_id=31435

Sorry, this isn't the right fix.  There is no case before this 
patch in which PyFloat_FromString() can raise 
OverflowError.  As the comments say,

/* We don't care about overflow or underflow.  If the
platform supports
 * them, infinities and signed zeroes (on underflow) are fine.

If this platform is returning DBL_MAX, no problem, lots of 
platforms do.  I don't know why this platform goes on to 
raise ValueError, but the intent is that it return DBL_MAX 
and not raise any exception.

Assuming that the test failing is

    float(shuge) == int(shuge)

we don't expect the float(shuge) part to raise anything, we 
expect the int(shuge) part to raise OverflowError.


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-25 10:33

Message:
Logged In: YES 
user_id=33168

Tim, could you take a quick look at this patch (or
unassign)?  It's pretty simple and we could close a bug and
a patch. :-)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=719359&group_id=5470