[Patches] [ python-Patches-719359 ] fix test_long failure on OSF/1
SourceForge.net
noreply@sourceforge.net
Mon, 02 Jun 2003 05:32:14 -0700
Patches item #719359, was opened at 2003-04-11 01:15
Message generated for change (Comment added) made by mmokrejs
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: Closed
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 Mokrejs (mmokrejs)
Date: 2003-06-02 14:32
Message:
Logged In: YES
user_id=696559
OK, I managed to download cvs module named python:
./configure --prefix=/software/@sys/usr
[...]
checking whether pthreads are available without options... no
checking whether cc accepts -Kpthread... no
checking whether cc accepts -Kthread... no
checking whether cc accepts -pthread... yes
[...]
checking for --with-libs... no
checking for --with-signal-module... yes
checking for --with-dec-threads... no
checking for --with-threads... yes
checking if PTHREAD_SCOPE_SYSTEM is supported... yes
checking for pthread_sigmask... yes
checking if --enable-ipv6 is specified... yes
configure:3774: checking whether pthreads are available
without options
configure:3800: cc -o conftest -O2 -arch ev56
-I/software/@sys/usr/include -I/usr/local/include
-I/usr/local/openssl/include conftest.c
-L/usr/local/lib -L/software/@sys/usr/lib
-L/usr/local/openssl/lib -L/usr/lib >&5
cc: Error: /usr/include/pthread.h, line 312: #error "Please
compile the module including pthread.h with -pthread"
(errormessage)
# error "Please compile the module including pthread.h with
-pthread"
---^
configure:3803: $? = 1
configure: program exited with status 1
configure: failed program was:
#line 3782 "configure"
#include "confdefs.h"
#include <pthread.h>
void* routine(void* p){return NULL;}
int main(){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
(void)pthread_detach(p);
return 0;
}
configure:3823: result: no
configure:3836: checking whether cc accepts -Kpthread
configure:3864: cc -Kpthread -o conftest -O2 -arch ev56
-I/software/@sys/usr/include -I/usr/local/include
-I/usr/local/openssl/include
conftest.c -L/usr/local/lib -L/software/@sys/usr/lib
-L/usr/local/openssl/lib -L/usr/lib >&5
cc: Error: /usr/include/pthread.h, line 312: #error "Please
compile the module including pthread.h with -pthread"
(errormessage)
# error "Please compile the module including pthread.h with
-pthread"
---^
configure:3867: $? = 1
configure: program exited with status 1
configure: failed program was:
#line 3846 "configure"
#include "confdefs.h"
#include <pthread.h>
void* routine(void* p){return NULL;}
int main(){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
(void)pthread_detach(p);
return 0;
}
configure:3887: result: no
configure:3898: checking whether cc accepts -Kthread
configure:3926: cc -Kthread -o conftest -O2 -arch ev56
-I/software/@sys/usr/include -I/usr/local/include
-I/usr/local/openssl/include c
onftest.c -L/usr/local/lib -L/software/@sys/usr/lib
-L/usr/local/openssl/lib -L/usr/lib >&5
cc: Error: /usr/include/pthread.h, line 312: #error "Please
compile the module including pthread.h with -pthread"
(errormessage)
# error "Please compile the module including pthread.h with
-pthread"
---^
configure:3929: $? = 1
configure: program exited with status 1
configure: failed program was:
#line 3908 "configure"
#include "confdefs.h"
#include <pthread.h>
void* routine(void* p){return NULL;}
int main(){
pthread_t p;
if(pthread_create(&p,NULL,routine,NULL)!=0)
return 1;
(void)pthread_detach(p);
return 0;
}
configure:3949: result: no
configure:3960: checking whether cc accepts -pthread
configure:3988: cc -pthread -o conftest -O2 -arch ev56
-I/software/@sys/usr/include -I/usr/local/include
-I/usr/local/openssl/include c
onftest.c -L/usr/local/lib -L/software/@sys/usr/lib
-L/usr/local/openssl/lib -L/usr/lib >&5
configure:3991: $? = 0
configure:3993: ./conftest
configure:3996: $? = 0
configure:4011: result: yes
configure:4214: checking pthread.h usability
configure:4223: cc -c -O2 -arch ev56
-I/software/@sys/usr/include -I/usr/local/include
-I/usr/local/openssl/include conftest.c >&5
cc: Error: /usr/include/pthread.h, line 312: #error "Please
compile the module including pthread.h with -pthread"
(errormessage)
# error "Please compile the module including pthread.h with
-pthread"
---^
configure:4226: $? = 1
[...]
configure:4241: result: no
configure:4245: checking pthread.h presence
configure:4252: cc -E -I/software/@sys/usr/include
-I/usr/local/include -I/usr/local/openssl/include conftest.c
cc: Error: /usr/include/pthread.h, line 312: #error "Please
compile the module including pthread.h with -pthread"
(errormessage)
# error "Please compile the module including pthread.h with
-pthread"
---^
configure:4258: $? = 1
configure: failed program was:
#line 4247 "configure"
#include "confdefs.h"
#include <pthread.h>
configure:4276: result: no
configure:4294: checking for pthread.h
configure:4301: result: no
So, I have set -pthread manully:
CC="cc -pthread -g2" CXX="cxx -pthread -g2" ./configure
--prefix=/software/@sys/usr
during make I see:
building 'readline' extension
cc -pthread -g2 -DNDEBUG -O -ieee -std -Olimit 1500 -I.
-I/mnt/python/dist/src/./Include
-I/software/@sys/usr/include -I/usr/local/include
-I/mnt/python/dist/src/Include -I/mnt/python/dist/src -c
/mnt/python/dist/src/Modules/readline.c -o
build/temp.osf1-V5.1-alpha-2.3/readline.o
cc: Info: File not optimized; use -g3 if both optimization
and debug wanted. (suppressoptlvl)
cc: Warning: /mnt/python/dist/src/Modules/readline.c, line
100: In this declaration, "history_length" is declared with
both internal and external linkage. The previous
declaration is at line number 224 in file
/software/@sys/usr/include/readline/history.h. (mixlinkage)
static int history_length = -1; /* do not truncate history
by default */
-----------^
[...]
building 'bsddb185' extension
cc -pthread -g2 -DNDEBUG -O -ieee -std -Olimit 1500 -I.
-I/mnt/python/dist/src/./Include
-I/software/@sys/usr/include -I/usr/local/include
-I/mnt/python/dist/src/Include -I/mnt/python/dist/src -c
/mnt/python/dist/src/Modules/bsddbmodule.c -o
build/temp.osf1-V5.1-alpha-2.3/bsddbmodule.o
cc: Info: File not optimized; use -g3 if both optimization
and debug wanted. (suppressoptlvl)
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
58: In this declaration, "HASHINFO" must specify a type.
(badparsedecl)
HASHINFO info;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
106: In this declaration, "BTREEINFO" must specify a type.
(badparsedecl)
BTREEINFO info;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
156: In this declaration, "RECNOINFO" must specify a type.
(badparsedecl)
RECNOINFO info;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
276: In this declaration, "recno_t" must specify a type.
(badparsedecl)
recno_t recno;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
327: In this declaration, "recno_t" must specify a type.
(badparsedecl)
recno_t recno;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
470: In this declaration, "recno_t" must specify a type.
(badparsedecl)
recno_t recno;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
509: In this declaration, "recno_t" must specify a type.
(badparsedecl)
recno_t recno;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
63: In this statement, "info" is not declared. (undeclared)
info.bsize = bsize;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
111: In this statement, "info" is not declared. (undeclared)
info.flags = btflags;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
162: In this statement, "info" is not declared. (undeclared)
info.flags = rnflags;
--------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
223: In this statement, "(dp->di_bsddb->close)" expects 2
arguments, but 1 are supplied. (toofewargs)
status = (dp->di_bsddb->close)(dp->di_bsddb);
-------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
252: In this statement, "seq" is not a member of
"dp->di_bsddb". (needmember)
for (status = (dp->di_bsddb->seq)(dp->di_bsddb,
-------------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
255: In this statement, "seq" is not a member of
"dp->di_bsddb". (needmember)
status = (dp->di_bsddb->seq)(dp->di_bsddb,
-------------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
279: In this statement, "recno" is not declared. (undeclared)
if (!PyArg_Parse(key, "i", &recno)) {
--------------------------------------------^
cc: Warning: /mnt/python/dist/src/Modules/bsddbmodule.c,
line 299: In this statement, the referenced type of the
pointer value "&krec" is "struct __db_dbt", which is not
compatible with "struct __db_txn". (ptrmismatch)
status = (dp->di_bsddb->get)(dp->di_bsddb, &krec,
&drec, 0);
---------------------------------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
299: In this statement, "(dp->di_bsddb->get)" expects 5
arguments, but 4 are supplied. (toofewargs)
status = (dp->di_bsddb->get)(dp->di_bsddb, &krec,
&drec, 0);
-----------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
330: In this statement, "recno" is not declared. (undeclared)
if (!PyArg_Parse(key, "i", &recno)) {
--------------------------------------------^
cc: Warning: /mnt/python/dist/src/Modules/bsddbmodule.c,
line 351: In this statement, the referenced type of the
pointer value "&krec" is "struct __db_dbt", which is not
compatible with "struct __db_txn". (ptrmismatch)
status = (dp->di_bsddb->del)(dp->di_bsddb,
&krec, 0);
-----------------------------------------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
351: In this statement, "(dp->di_bsddb->del)" expects 4
arguments, but 3 are supplied. (toofewargs)
status = (dp->di_bsddb->del)(dp->di_bsddb,
&krec, 0);
-------------------------^
cc: Warning: /mnt/python/dist/src/Modules/bsddbmodule.c,
line 363: In this statement, the referenced type of the
pointer value "&krec" is "struct __db_dbt", which is not
compatible with "struct __db_txn". (ptrmismatch)
status = (dp->di_bsddb->put)(dp->di_bsddb,
&krec, &drec, 0);
-----------------------------------------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
363: In this statement, "(dp->di_bsddb->put)" expects 5
arguments, but 4 are supplied. (toofewargs)
status = (dp->di_bsddb->put)(dp->di_bsddb,
&krec, &drec, 0);
-------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
388: In this statement, "(dp->di_bsddb->close)" expects 2
arguments, but 1 are supplied. (toofewargs)
status = (dp->di_bsddb->close)(dp->di_bsddb);
-------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
415: In this statement, "seq" is not a member of
"dp->di_bsddb". (needmember)
status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec,
&drec, R_FIRST);
------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
441: In this statement, "seq" is not a member of
"dp->di_bsddb". (needmember)
status = (dp->di_bsddb->seq)
--------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
474: In this statement, "recno" is not declared. (undeclared)
&recno)) {
---------------------------------------^
cc: Warning: /mnt/python/dist/src/Modules/bsddbmodule.c,
line 491: In this statement, the referenced type of the
pointer value "&krec" is "struct __db_dbt", which is not
compatible with "struct __db_txn". (ptrmismatch)
status = (dp->di_bsddb->get)(dp->di_bsddb, &krec,
&drec, 0);
---------------------------------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
491: In this statement, "(dp->di_bsddb->get)" expects 5
arguments, but 4 are supplied. (toofewargs)
status = (dp->di_bsddb->get)(dp->di_bsddb, &krec,
&drec, 0);
-----------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
513: In this statement, "recno" is not declared. (undeclared)
&recno)) {
---------------------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
530: In this statement, "seq" is not a member of
"dp->di_bsddb". (needmember)
status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec,
&drec, R_CURSOR);
------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
570: In this statement, "seq" is not a member of
"dp->di_bsddb". (needmember)
status = (dp->di_bsddb->seq)(dp->di_bsddb, &krec,
------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
608: In this statement, "R_NEXT" is not declared. (undeclared)
return bsddb_seq(dp, R_NEXT);
-----------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
613: In this statement, "R_PREV" is not declared. (undeclared)
return bsddb_seq(dp, R_PREV);
-----------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
618: In this statement, "R_FIRST" is not declared. (undeclared)
return bsddb_seq(dp, R_FIRST);
-----------------------------^
cc: Error: /mnt/python/dist/src/Modules/bsddbmodule.c, line
623: In this statement, "R_LAST" is not declared. (undeclared)
return bsddb_seq(dp, R_LAST);
-----------------------------^
building 'dbm' extension
[...]
ld -shared -expect_unresolved *
build/temp.osf1-V5.1-alpha-2.3/_cursesmodule.o
-L/software/@sys/usr/lib -L/usr/local/lib -lncurses -o
build/lib.osf1-V5.1-alpha-2.3/_curses.so
*** WARNING: renaming "_curses" since importing it failed:
dlopen: build/lib.osf1-V5.1-alpha-2.3/_curses.so: symbol
"_acs_map" unresolved
building '_curses_panel' extension
cc -pthread -g2 -DNDEBUG -O -ieee -std -Olimit 1500 -I.
-I/mnt/python/dist/src/./Include
-I/software/@sys/usr/include -I/usr/local/include
-I/mnt/python/dist/src/Include -I/mnt/python/dist/src -c
/mnt/python/dist/src/Modules/_curses_panel.c -o
build/temp.osf1-V5.1-alpha-2.3/_curses_panel.o
cc: Info: File not optimized; use -g3 if both optimization
and debug wanted. (suppressoptlvl)
cc: Severe: /mnt/python/dist/src/Modules/_curses_panel.c,
line 17: Cannot find file <panel.h> specified in #include
directive. (noinclfilef)
#include <panel.h>
-^
building 'zlib' extension
[...]
It seems the test_long bug is fixed already in cvs:
$ ./python -E -tt ./Lib/test/test_long.py
long / * % divmod
Karatsuba
long bit-operation identities
long str/hex/oct/atol
long miscellaneous operations
auto-convert int->long on overflow
long->float overflow
log and log10
$
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2003-05-26 16:12
Message:
Logged In: YES
user_id=33168
Checked in as:
* configure 1.402
* configure.in 1.413
----------------------------------------------------------------------
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