This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients landry, mark.dickinson, rpointel, vstinner
Date 2011-07-22.15:28:02
SpamBayes Score 5.745178e-07
Marked as misclassified No
Message-id <1311348483.21.0.300907746096.issue12589@psf.upfronthosting.co.za>
In-reply-to
Content
> $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
---------------------------------------------
History
Date User Action Args
2011-07-22 15:28:03vstinnersetrecipients: + vstinner, mark.dickinson, rpointel, landry
2011-07-22 15:28:03vstinnersetmessageid: <1311348483.21.0.300907746096.issue12589@psf.upfronthosting.co.za>
2011-07-22 15:28:02vstinnerlinkissue12589 messages
2011-07-22 15:28:02vstinnercreate