[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2014-06-27 Thread Mark Lawrence

Mark Lawrence added the comment:

Can this be reproduced on 3.4/5?

--
nosy: +BreamoreBoy
type:  -> behavior
versions: +Python 3.4, Python 3.5 -Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-19 Thread rpointel

New submission from rpointel :

Hello,
the test test_nan_inf failed on OpenBSD on powerpc architecture.
It works fine on amd64 and sparc64.

Don't hesitate if you need more informations.
Details:

Re-running test 'test_long' in verbose mode
test__format__ (test.test_long.LongTest) ... ok
test_bit_length (test.test_long.LongTest) ... ok
test_bitop_identities (test.test_long.LongTest) ... ok
test_conversion (test.test_long.LongTest) ... ok
test_correctly_rounded_true_division (test.test_long.LongTest) ... ok
test_division (test.test_long.LongTest) ... ok
test_float_conversion (test.test_long.LongTest) ... ok
test_float_overflow (test.test_long.LongTest) ... ok
test_format (test.test_long.LongTest) ... ok
test_from_bytes (test.test_long.LongTest) ... ok
test_karatsuba (test.test_long.LongTest) ... ok
test_logs (test.test_long.LongTest) ... ok
test_long (test.test_long.LongTest) ... ok
test_mixed_compares (test.test_long.LongTest) ... ok
test_nan_inf (test.test_long.LongTest) ... FAIL
test_round (test.test_long.LongTest) ... ok
test_small_ints (test.test_long.LongTest) ... ok
test_to_bytes (test.test_long.LongTest) ... ok
test_true_division (test.test_long.LongTest) ... 
/usr/obj/ports/Python-3.2.1/Python-3.2.1/Lib/test/regrtest.py:1053: 
ResourceWarning: unclosed 
  gc.collect()
/usr/obj/ports/Python-3.2.1/Python-3.2.1/Lib/test/regrtest.py:1053: 
ResourceWarning: unclosed 
  gc.collect()
/usr/obj/ports/Python-3.2.1/Python-3.2.1/Lib/test/regrtest.py:1053: 
ResourceWarning: unclosed 
  gc.collect()
test test_long failed
ok

==
FAIL: test_nan_inf (test.test_long.LongTest)
--
Traceback (most recent call last):
  File "/usr/obj/ports/Python-3.2.1/Python-3.2.1/Lib/test/test_long.py", line 
633, in test_nan_inf
self.assertRaises(OverflowError, int, float('inf'))
AssertionError: OverflowError not raised by int

--
Ran 19 tests in 25.020s

FAILED (failures=1)

--
components: Tests
messages: 140697
nosy: rpointel
priority: normal
severity: normal
status: open
title: test_long.test_nan_inf() failed on OpenBSD (powerpc)
versions: Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-19 Thread STINNER Victor

STINNER Victor  added the comment:

What is the result of int(float('inf')) ?

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-20 Thread Landry Breuil

Landry Breuil  added the comment:

$python3.2
Python 3.2.1 (default, Jul 18 2011, 10:56:33) 
[GCC 4.2.1 20070719 ] on openbsd4
>>> int(float('inf'))
0
$sysctl hw
hw.machine=macppc

--
nosy: +landry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-21 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-21 Thread STINNER Victor

STINNER Victor  added the comment:

Is HAVE_DECL_ISINF defined in pyconfig.h? PyLong_FromDouble() uses 
Py_IS_INFINITY(x):
--
/* Py_IS_INFINITY(X)
 * Return 1 if float or double arg is an infinity, else 0.
 * Caution:
 *X is evaluated more than once.
 *This implementation may set the underflow flag if |X| is very small;
 *it really can't be implemented correctly (& easily) before C99.
 *Override in pyconfig.h if you have a better spelling on your platform.
 *  Py_FORCE_DOUBLE is used to avoid getting false negatives from a
 *non-infinite value v sitting in an 80-bit x87 register such that
 *v becomes infinite when spilled from the register to 64-bit memory.
 * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf
 */
#ifndef Py_IS_INFINITY
#  if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
#define Py_IS_INFINITY(X) isinf(X)
#  else
#define Py_IS_INFINITY(X) ((X) &&   \
   (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
#  endif
#endif
--

main() in Modules/python.c starts with:
--
/* 754 requires that FP exceptions run in "no stop" mode by default,
 * and until C vendors implement C99's ways to control FP exceptions,
 * Python requires non-stop mode.  Alas, some platforms enable FP
 * exceptions by default.  Here we disable them.
 */
#ifdef __FreeBSD__
fp_except_t m;

m = fpgetmask();
fpsetmask(m & ~FP_X_OFL);
#endif
--

You may try to enable this code on OpenBSD, replace "#ifdef __FreeBSD__" by 
"#if 1".

Can you also please try the following code?

$ python
>>> import struct
>>> struct.pack("f", float("inf"))
b'\x00\x00\x80\x7f'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

The result of:

struct.pack("d", float("inf"))

would also be interesting.  I'd expect to see:

'\x7f\xf0\x00\x00\x00\x00\x00\x00'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-21 Thread Landry Breuil

Landry Breuil  added the comment:

>>> import struct
>>> struct.pack("d", float("inf"))
b'\x7f\xf0\x00\x00\x00\x00\x00\x00'
>>> struct.pack("f", float("inf"))
b'\x7f\x80\x00\x00'

And yes, HAVE_DECL_ISINF is defined to 1 in pyconfig.h

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-21 Thread STINNER Victor

STINNER Victor  added the comment:

You may try:

$ ./python
>>> import ctypes
>>> import ctypes.util
>>> libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
>>> isinf = libc.isinf
>>> isinf.argtypes = (ctypes.c_double,)
>>> isinf(0.0)
0
>>> isinf(float('inf'))
1

(try ctypes.util.find_library('m') if isinf is not in libc)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-21 Thread Landry Breuil

Landry Breuil  added the comment:

Python 3.2.1 (default, Jul 18 2011, 10:56:33) 
[GCC 4.2.1 20070719 ] on openbsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> import ctypes.util
>>> libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
>>> isinf = libc.isinf
>>> isinf.argtypes = (ctypes.c_double,)
>>> isinf(0.0)
0
>>> isinf(float('inf'))
1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread STINNER Victor

STINNER Victor  added the comment:

The problem is in PyLong_FromDouble(): if (Py_IS_INFINITY(dval)) is evaluated 
as false, whereas dval *is* infinity. Possible causes:

 - Py_IS_INFINITY is not defined as "# define Py_IS_INFINITY(X) isinf(X)" 
(issue with the pyconfig.h file?)
 - the compiler replaces isinf(X) by something else (!?)
 - isinf() is not called with the right argument (conversion between 32, 64 
and/or 80 floats?)
 - issue with the FPU mode (unlikely because in your ctypes test, 
isinf(float("inf")) returns 1, and this test runs in the Python process)

Try to run python in gdb. Set a breakpoint on isinf() (or on 
PyLong_FromDouble() and use step by step) to check that the function is really 
called, and called with the "right" argument.

You may also try to replace Py_IS_INFINITY(dval) directly by isinf(dval) (or 
simply if(1) :-)) in PyLong_FromDouble().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread Landry Breuil

Landry Breuil  added the comment:

$grep -r '#define Py_IS_INF' .
PC/pyconfig.h:#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))


>>> isinf(float('inf'))

Breakpoint 2, __isinf (d=1.0604798301039825e-314) at 
/usr/src/lib/libc/gen/isinf.c:30
30  in /usr/src/lib/libc/gen/isinf.c
(gdb) bt
#0  __isinf (d=1.0604798301039825e-314) at /usr/src/lib/libc/gen/isinf.c:30
#1  0x8fe528d8 in ffi_call_SYSV () from /usr/local/lib/libffi.so.0.0

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

The '1.06...e-314' number in the gdb output is interesting:  it indicates a 
byte-ordering issue, though maybe that issue is only pertinent to gdb itself.

On a little-endian machine:

>>> struct.pack('>> struct.pack('

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

Question: does this test also fail after configuring with the --with-pydebug 
flag?  (Which I *think* should turn compiler optimizations off, amongst other 
things.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread STINNER Victor

STINNER Victor  added the comment:

> $grep -r '#define Py_IS_INF' .
> PC/pyconfig.h:#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))

The PC/ directory is specific to Windows. Py_IS_INFINITY should be defined in 
Include/pymath.h (at least, in the 3.2 branch)

> Breakpoint 2, __isinf (d=1.0604798301039825e-314)
> ...
> #1  0x8fe528d8 in ffi_call_SYSV () from /usr/local/lib/libffi.so.0.0

Ah, you ran gdb on ctypes. I forgot to specify that you should run gdb on 
"int(float('inf'))" instruction in Python, sorry. I would like to check 
int(float), not ctypes ;-)

If gdb has an endian issue, you may also try "print /x d" in the gdb shell.

Example on x86_64:
-
$ gdb ./python 
GNU gdb (GDB) 7.1-ubuntu
...
(gdb) run

(gdb) b isinf
Breakpoint 1 at 0xb7f94f16: file ../sysdeps/ieee754/dbl-64/s_isinf.c, line 23. 
(2 locations)
(gdb) cont
>>> int(float('inf'))

Breakpoint 1, *__GI___isinf (x=inf) at ../sysdeps/ieee754/dbl-64/s_isinf.c:23
23  ../sysdeps/ieee754/dbl-64/s_isinf.c: Aucun fichier ou dossier de ce 
type.
in ../sysdeps/ieee754/dbl-64/s_isinf.c
(gdb) print /x x
$1 = 0x8000

(gdb) where
#0  *__GI___isinf (x=inf) at ../sysdeps/ieee754/dbl-64/s_isinf.c:23
#1  0x0819b03e in PyLong_FromDouble (dval=inf) at Objects/longobject.c:280
#2  0x0818d660 in float_trunc (v=) at 
Objects/floatobject.c:896
#3  0x081619c6 in PyNumber_Long (o=) at 
Objects/abstract.c:1348
#4  0x081a4823 in long_new (type=0x824b420, args=(,), kwds=0x0) at Objects/longobject.c:4130
...
(gdb) frame 1
#1  0x0819b03e in PyLong_FromDouble (dval=inf) at Objects/longobject.c:280
280 if (Py_IS_INFINITY(dval)) {
(gdb) print /x dval
$2 = 0x8000
-

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread STINNER Victor

STINNER Victor  added the comment:

> If gdb has an endian issue,
> you may also try "print /x d" in the gdb shell.

Oh, forget me: /x converts the argument to an integer...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread Landry Breuil

Landry Breuil  added the comment:

Py_IS_INFINITY is defined as

#ifndef Py_IS_INFINITY
#  if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
#define Py_IS_INFINITY(X) isinf(X)
#  else
#define Py_IS_INFINITY(X) ((X) &&   \
   (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
#  endif
#endif


The test still fails when built --with-pydebug.

(gdb)  b isinf 
Function "isinf" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (isinf) pending.
(gdb) r
Starting program: /usr/obj/ports/Python-3.2.1/Python-3.2.1/python 
Breakpoint 2 at 0x852786d4: file /usr/src/lib/libc/gen/isinf.c, line 27.
Pending breakpoint "isinf" resolved
Python 3.2.1 (default, Jul 22 2011, 17:34:54) 
[GCC 4.2.1 20070719 ] on openbsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> int(float('inf'))
0
[56408 refs]

isinf is #defined in math.h to

#define isinf(x) \
((sizeof (x) == sizeof (float)) ? \
__isinff(x) \
: (sizeof (x) == sizeof (double)) ? \
__isinf(x) \
:   __isinfl(x))

but setting a bkp on it changes nothing.

Starting program: /usr/obj/ports/Python-3.2.1/Python-3.2.1/python 
Breakpoint 2 at 0x89b4f708: file /usr/src/lib/libc/gen/isinf.c, line 36.
Pending breakpoint "__isinff" resolved
Python 3.2.1 (default, Jul 22 2011, 17:34:54) 
[GCC 4.2.1 20070719 ] on openbsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> int(float('inf'))
0

Setting a bkp on PyLong_FromDouble() shows that it's not called.

Sorry, this doesnt make sense to me...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-07-22 Thread STINNER Victor

STINNER Victor  added the comment:

I'm not sure that your version of gdb understands macros. You may have to set a 
breakpoint on __isinf. Compile Python with "-g -ggdb" helps gdb.

Py_IS_INFINITY is may not defined as "# define Py_IS_INFINITY(X) isinf(X)". To 
check that, add #error macro in pymath.h for all cases around #ifndef 
Py_IS_INFINITY. For example:

#ifndef Py_IS_INFINITY
#  if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
#error "Py_IS_INFINITY is implemented using isinf()"
#define Py_IS_INFINITY(X) isinf(X)
#  else
#error "Py_IS_INFINITY is implemented using *0.5"
#define Py_IS_INFINITY(X) ((X) &&   \
   (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
#  endif
#else
#  error "Py_IS_INFINITY already set!?"
#endif

And recompile Python. It may be a typo in pyconfig.h (generated by configure) 
or an issue with the inclusion paths of gcc (-I options).

Can you please attach your pyconfig.h and /usr/include/math.h files?

Can you also copy-paste the line used to compile Object/floatobject.c (to check 
the compiler options)? Use touch Object/floatobject.c && make to recompile this 
file.

FYI, isinf() is also a macro on Linux:

# ifdef __NO_LONG_DOUBLE_MATH
#  define isinf(x) \
 (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x))
# else
#  define isinf(x) \
 (sizeof (x) == sizeof (float)\
  ? __isinff (x)  \
  : sizeof (x) == sizeof (double) \
  ? __isinf (x) : __isinfl (x))
# endif

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil

Landry Breuil  added the comment:

floatobject.c is compiled with 

cc -pthread -c -fno-strict-aliasing -O2 -pipe  -Wall 
-DTHREAD_STACK_SIZE=0x2 -fPIC -O2 -pipe -Wall -I. -IInclude -I./Include   
-fPIC -DPy_BUILD_CORE -o Objects/floatobject.o Objects/floatobject.c

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil

Changes by Landry Breuil :


Added file: http://bugs.python.org/file22854/pyconfig.h

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil

Changes by Landry Breuil :


Added file: http://bugs.python.org/file22855/math.h

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil

Landry Breuil  added the comment:

Interestingly, after an update of the system i can't build python 3.2.1 anymore 
:

/usr/include/util.h:102: error: conflicting types for 'openpty'
Include/pyport.h:634: error: previous declaration of 'openpty' was here
/usr/include/util.h:105: error: conflicting types for 'forkpty'
Include/pyport.h:635: error: previous declaration of 'forkpty' was here

./Modules/posixmodule.c: In function 'posix_lstat':
./Modules/posixmodule.c:5155: error: 'lstat' undeclared (first use in this 
function)
./Modules/posixmodule.c:5155: error: (Each undeclared identifier is reported 
only once
./Modules/posixmodule.c:5155: error: for each function it appears in.)


Relevant lines of configure output (so those seem to come from systemwide 
config.site) :
checking for lstat... (cached) yes
checking for openpty... (cached) no
checking for openpty in -lutil... (cached) yes
checking for forkpty... yes

I'm attaching the generated pyconfig.h and the build log, but now that seems to 
be a different issue.. as pyconfig.h clearly contains wrong defs.

Don't count on me too much for that issue, i have honestly no interest in 
python and lost enough time on that... i trust remi to pick up on it :)

--
Added file: http://bugs.python.org/file22856/pyconfig.h.wrong

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil

Changes by Landry Breuil :


Added file: http://bugs.python.org/file22857/build-macppc.log

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-22 Thread Remi Pointel

Remi Pointel  added the comment:

Hi,
what information do you need to advance on this bug?
Cheers,
Remi.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-29 Thread STINNER Victor

STINNER Victor  added the comment:

> what information do you need to advance on this bug?

It would be easier to debug if I had access to OpenBSD on a PowerPC host.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2019-03-15 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com