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 kumma
Recipients brian.curtin, eric.araujo, kumma, theller
Date 2010-06-22.07:43:56
SpamBayes Score 0.000411069
Marked as misclassified No
Message-id <>
In-reply-to <>
I'm a newbie what it comes to Python's C-sources, so please do not
take me too seriously.
I fetched the sources 'svn checkout '
studied the issue, and my best guess is that
Modules/_ctypes/cfield.c 's funktion d_set is called, when converting
something to ctypes.c_double

Please check, that this is what happens :)

If so, Objects/longobject.c's function double PyLong_AsDouble(PyObject
*vv) sets the overflow exception, but d_set overwrites it, like you
can see:

static PyObject *
d_set(void *ptr, PyObject *value, Py_ssize_t size)
    double x;

    x = PyFloat_AsDouble(value);
    if (x == -1 && PyErr_Occurred()) {
                     " float expected instead of %s instance",
        return NULL;
    memcpy(ptr, &x, sizeof(double));

Perhaps something like:
if (PyErr_ExceptionMatches(PyExc_OverflowError)){
	return NULL;

just after the line:
'f (x == -1 && PyErr_Occurred()) {'
could fix this?

 But like I said, I'm an newbie, this was actually my first  look into
Python/C API  and I have not tested this fix in any way whatsoever
Date User Action Args
2010-06-22 07:43:59kummasetrecipients: + kumma, theller, eric.araujo, brian.curtin
2010-06-22 07:43:57kummalinkissue9041 messages
2010-06-22 07:43:56kummacreate