[issue4880] PyInt_FromSsize_t LONG_MIN and LONG_MAX typecasts needed

Luke Kenneth Casson Leighton report at bugs.python.org
Thu Jan 8 15:56:30 CET 2009


New submission from Luke Kenneth Casson Leighton <lkcl at lkcl.net>:

there's probably a better way to do this (or a better reason), but
LONG_MIN and LONG_MAX end up as the wrong constant types when compiling
python2.5.2 under wine (don't ask...)

PyObject *
PyInt_FromSsize_t(Py_ssize_t ival)
{
    if ((long)ival >= (long)LONG_MIN && (long)ival <= (long)LONG_MAX)
    {
        return PyInt_FromLong((long)ival);
    }
    return _PyLong_FromSsize_t(ival);
}

----------
messages: 79411
nosy: lkcl
severity: normal
status: open
title: PyInt_FromSsize_t LONG_MIN and LONG_MAX typecasts needed
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4880>
_______________________________________


More information about the Python-bugs-list mailing list