[New-bugs-announce] [issue29522] PyLong_AsDouble Behaviour is Weird

nico report at bugs.python.org
Fri Feb 10 03:55:23 EST 2017


New submission from nico:

I'm using the pre-installed version of Python 2.7.12 on Ubuntu 16.04. Pretty straight forward error the following code:

PyObject * intobj = PyInt_FromLong(10);
double d1 = (double)PyLong_AsLong(intobj);
double d2 = PyLong_AsDouble(intobj);
printf("Should be the same: %f vs %f", d1, d2);

Does not display the same number for both double since `PyLong_AsDouble` raises the error, SystemError: ../Objects/longobject.c:2336: bad argument to internal function and returns -1.0 instead of 10.0.

----------
components: Build
messages: 287486
nosy: nico
priority: normal
severity: normal
status: open
title: PyLong_AsDouble Behaviour is Weird
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29522>
_______________________________________


More information about the New-bugs-announce mailing list