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 izbyshev
Recipients eric.snow, izbyshev, vstinner
Date 2019-02-11.21:52:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549921968.67.0.462504390355.issue35972@roundup.psfhosted.org>
In-reply-to
Content
Victor Stinner pointed out that on x86 Gentoo Installed with X 3.x buildbot, there is a compiler warning:

Python/pystate.c:1483:18: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]

(https://buildbot.python.org/all/#/builders/103/builds/2067)

This warning reveals a bug:

static int
_long_shared(PyObject *obj, _PyCrossInterpreterData *data)
{
    int64_t value = PyLong_AsLongLong(obj);
    if (value == -1 && PyErr_Occurred()) {
        if (PyErr_ExceptionMatches(PyExc_OverflowError)) {
            PyErr_SetString(PyExc_OverflowError, "try sending as bytes");
        }
        return -1;
    }
    data->data = (void *)value;

A 64-bit value is converted to void *, which is 32-bit on 32-bit platforms.

I've implemented a PR that uses Py_ssize_t instead to match the pointer size and to preserve the ability to work with negative numbers.
History
Date User Action Args
2019-02-11 21:52:48izbyshevsetrecipients: + izbyshev, vstinner, eric.snow
2019-02-11 21:52:48izbyshevsetmessageid: <1549921968.67.0.462504390355.issue35972@roundup.psfhosted.org>
2019-02-11 21:52:48izbyshevlinkissue35972 messages
2019-02-11 21:52:48izbyshevcreate