[issue29522] PyLong_AsDouble Behaviour is Weird

2017-02-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is incorrect use of PyLong_AsDouble(). It should be used with a long object, but you use it with an int object. -- nosy: +serhiy.storchaka resolution: -> not a bug stage: -> resolved status: open -> closed

[issue29522] PyLong_AsDouble Behaviour is Weird

2017-02-10 Thread nico
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: