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

SourceForge.net noreply@sourceforge.net
Sun, 25 May 2003 22:40:01 -0700


Patches item #719359, was opened at 2003-04-11 01:15
Message generated for change (Comment added) made by loewis
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: Accepted
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
>Assigned to: Neal Norwitz (nnorwitz)
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: Martin v. Löwis (loewis)
Date: 2003-05-26 07:40

Message:
Logged In: YES 
user_id=21627

I see. The patch is fine, please apply it.

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-26 01:49

Message:
Logged In: YES 
user_id=33168

It shouldn't break gcc support.  There is an outer case
$GCC, the case which OSF* is in only is tested when $GCC != yes.

It appears there are more issues associated with -pthread, I
think that should be dropped from this patch.  So the line
would be:

 BASECFLAGS="$BASECFLAGS -ieee -std"

I'd also like to see if this fixes the other people's
problem.  I don't get a SIGFPE, but the test_long problem is
fixed with this patch (specifically -ieee).

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

Comment By: Martin v. Löwis (loewis)
Date: 2003-05-25 22:40

Message:
Logged In: YES 
user_id=21627

I'm pretty sure that this will break gcc support on that
system. You could add a if not-gcc test; see other systems
for examples.

As for -pthread, please see 742741. I think configure should
detect presence of -pthread, and stop checking for libraries
to link. I assume that with -pthread, no additional -D/-l
flags need to be passed for threads?

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-25 18: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 17: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 16: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