You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PyInt_FromSsize_t LONG_MIN and LONG_MAX typecasts needed #49130
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...)
Interesting. How many of those casts are actually necessary to make
things work? Have you figured out more precisely why this is failing?
E.g., is it somehow that LONG_MIN ends up being an unsigned constant?
It seems to me that a better fix would be to fix LONG_MIN and LONG_MAX
somewhere in the configuration files; there are bound to be more uses of
LONG_MIN and LONG_MAX in the source that are going to cause problems.
P.S. Looking at your python-dev messages, does len([1, 2]) really return
1L? Not 2L?
lkcl commented on Jan 8, 2009
lkclmannequin
MannequinAuthor
More actions
oh, duh - 2L not 1L yes you're right :)
yeh i believe it's likely to be because in PC/pyconfig.h LONG_MAX is
#defined to 7fffffff not 7fffffffL i'll double-check.
you're right that would make life a looot easier.
lkcl commented on Jan 8, 2009
lkclmannequin
MannequinAuthor
More actions
.... hmmm... noo, it's already #defined to 0x7fffffffL in
both PC/pyconfig.h _and_ in /usr/include/wine/msvcrt/limits.h
#ifdef__WINE__/* weird: you have to typecast 0x7fffffffL to long */#undef LONG_MAX
#undef LONG_MIN
#defineLONG_MAX ((long)0x7FFFFFFFL)
#defineLONG_MIN ((long)(-LONG_MAX-1))
#else#ifndefLONG_MAX#ifSIZEOF_LONG==4#defineLONG_MAX 0X7FFFFFFFL
#elifSIZEOF_LONG==8#defineLONG_MAX 0X7FFFFFFFFFFFFFFFL
#else#error "could not set LONG_MAX in pyport.h"
#endif#endif#ifndefLONG_MIN#defineLONG_MIN (-LONG_MAX-1)
#endif
#endif /* __WINE__ */
loewis commented on Jan 8, 2009
loewismannequin
Mannequin
More actions
I think you should study the preprocessor output to find out what
LONG_MAX really expands to, at the point where it is used.
In any case, I'm tempted to close this as "works for me" - 0x7FFFFFFFL
is definitely a long constant in all compilers I know of.
Activity
lkcl commentedon Jan 8, 2009
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...)
mdickinson commentedon Jan 8, 2009
Interesting. How many of those casts are actually necessary to make
things work? Have you figured out more precisely why this is failing?
E.g., is it somehow that LONG_MIN ends up being an unsigned constant?
It seems to me that a better fix would be to fix LONG_MIN and LONG_MAX
somewhere in the configuration files; there are bound to be more uses of
LONG_MIN and LONG_MAX in the source that are going to cause problems.
P.S. Looking at your python-dev messages, does len([1, 2]) really return
1L? Not 2L?
lkcl commentedon Jan 8, 2009
oh, duh - 2L not 1L yes you're right :)
yeh i believe it's likely to be because in PC/pyconfig.h LONG_MAX is
#defined to 7fffffff not 7fffffffL i'll double-check.
you're right that would make life a looot easier.
lkcl commentedon Jan 8, 2009
.... 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)
#endif /* __WINE__ */
loewis commentedon Jan 8, 2009
I think you should study the preprocessor output to find out what
LONG_MAX really expands to, at the point where it is used.
In any case, I'm tempted to close this as "works for me" - 0x7FFFFFFFL
is definitely a long constant in all compilers I know of.
mdickinson commentedon Feb 11, 2009
It seems likely that this is a wine bug rather than a Python bug.