Message189418
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). |
|
Date |
User |
Action |
Args |
2013-05-16 22:15:31 | vstinner | set | recipients:
+ vstinner, mark.dickinson, Devin Jeanpierre, skrah, serhiy.storchaka |
2013-05-16 22:15:31 | vstinner | set | messageid: <1368742531.14.0.705777053152.issue17870@psf.upfronthosting.co.za> |
2013-05-16 22:15:31 | vstinner | link | issue17870 messages |
2013-05-16 22:15:31 | vstinner | create | |
|