[issue4977] test_maxint64 fails on 32-bit systems due to assumption that 64-bit fits into "long"

Mark Dickinson report at bugs.python.org
Tue Jan 20 13:18:06 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

Antoine, I leave it to you to decide what to do with this.

As far as I can see, the only action that one might want to take
as a result of this issue is to replace strtol with PyOS_strol
in the codebase (in the struct module, and there's also an
occurrence in Objects/floatobject.c in the fromhex method).

I recommend against this though, for a few reasons:

1. PyOS_strtol is likely slower than strtol.

2. PyOS_strtol is itself buggy:  for example, it incorrectly
accepts strings like "- 3", with whitespace between the sign
and the unsigned part.  This is the reason that Python accepts
'- 3' as an input to int;  this is a Python bug that can't be
changed in 2.x for compatibility reasons.  It's fixed in 3.x.

3. There's nothing wrong with the existing code, and changing
it risks introducing new bugs.  It's the platform that's buggy here: 
its strtol method doesn't comply with the C89 standard (or the C99
standard, for that matter).

It's true that Python has code to work around problems with standards
compliance on some platforms, and if this were a supported platform
then I'd be okay with making the change.  As it is, though, I think this
should be reclosed (as invalid, or won't fix if that makes people feel
happier).

BTW, Luke, note that you can still add comments to an issue even after
the issue has been closed:  people subscribed to that issue (via nosy)
will still see the messages.

----------
assignee:  -> pitrou

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


More information about the Python-bugs-list mailing list