[issue4880] PyInt_FromSsize_t LONG_MIN and LONG_MAX typecasts needed

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


Luke Kenneth Casson Leighton <lkcl at lkcl.net> added the comment:

.... hmmm... noo, it's already #defined to 0x7fffffffL in
both PC/pyconfig.h _and_ in /usr/include/wine/msvcrt/limits.h

so .... this works (Include/pyports.h)

#ifdef __WINE__  /* weird: you have to typecast 0x7fffffffL to long */
#undef LONG_MAX
#undef LONG_MIN
#define LONG_MAX ((long)0x7FFFFFFFL)
#define LONG_MIN ((long)(-LONG_MAX-1))
#else
#ifndef LONG_MAX
#if SIZEOF_LONG == 4
#define LONG_MAX 0X7FFFFFFFL
#elif SIZEOF_LONG == 8
#define LONG_MAX 0X7FFFFFFFFFFFFFFFL
#else
#error "could not set LONG_MAX in pyport.h"
#endif
#endif

#ifndef LONG_MIN
#define LONG_MIN (-LONG_MAX-1)
#endif

#endif /* __WINE__ */

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


More information about the Python-bugs-list mailing list