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 Devin Jeanpierre, mark.dickinson, serhiy.storchaka, skrah, vstinner
Date 2013-05-16.22:15:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1368742531.14.0.705777053152.issue17870@psf.upfronthosting.co.za>
In-reply-to
Content
Oh, the sqlite3 module has an interesting function:

PyObject *
_pysqlite_long_from_int64(sqlite_int64 value)
{
#ifdef HAVE_LONG_LONG
# if SIZEOF_LONG_LONG < 8
    if (value > PY_LLONG_MAX || value < PY_LLONG_MIN) {
        return _PyLong_FromByteArray(&value, sizeof(value),
                                     IS_LITTLE_ENDIAN, 1 /* signed */);
    }
# endif
# if SIZEOF_LONG < SIZEOF_LONG_LONG
    if (value > LONG_MAX || value < LONG_MIN)
        return PyLong_FromLongLong(value);
# endif
#else
# if SIZEOF_LONG < 8
    if (value > LONG_MAX || value < LONG_MIN) {
        return _PyLong_FromByteArray(&value, sizeof(value),
                                     IS_LITTLE_ENDIAN, 1 /* signed */);
    }
# endif
#endif
    return PyLong_FromLong(value);
}

If PyLong_FromIntMax_t() is implemented, this function may be simply removed (and replaced with PyLong_FromIntMax_t).
History
Date User Action Args
2013-05-16 22:15:31vstinnersetrecipients: + vstinner, mark.dickinson, Devin Jeanpierre, skrah, serhiy.storchaka
2013-05-16 22:15:31vstinnersetmessageid: <1368742531.14.0.705777053152.issue17870@psf.upfronthosting.co.za>
2013-05-16 22:15:31vstinnerlinkissue17870 messages
2013-05-16 22:15:31vstinnercreate