STINNER Victor <victor.stin...@haypocalc.com> 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
<press ^C>
(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 = 0x8000000000000000

(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=<float at remote 0x826fb44>) at 
Objects/floatobject.c:896
#3  0x081619c6 in PyNumber_Long (o=<float at remote 0x826fb44>) at 
Objects/abstract.c:1348
#4  0x081a4823 in long_new (type=0x824b420, args=(<float at remote 
0x826fb44>,), 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 = 0x8000000000000000
---------------------------------------------

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12589>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to