This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Portability fixes in longobject.c
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: mark.dickinson
Priority: normal Keywords: patch

Created on 2008-11-23 12:28 by mark.dickinson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
longobject_casts.patch mark.dickinson, 2008-11-23 12:28
Messages (3)
msg76267 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-11-23 12:28
This patch fixes 3 classes of bugs in Objects/longobject.c:

(1) declarations of a variable (usually a counter into the digits of
a PyLong) as int instead of Py_ssize_t.
(2) missing (twodigits) casts from multiplies and shifts.
(3) use of '<<' on negative values in _PyLong_AsByteArray.  This
may lead to undefined behaviour, according to the C standards.  (See C99, 
section 6.5.7, paragraph 4).

These bugs haven't manifested themselves in practice.  For (1), there's 
only a problem when dealing with huge integers (more than 2**31 digits).   
The bugs in (2) can only affect platform where the C 'int' type has fewer 
than 32 bits.  (3) could potentially conflict with future compiler 
optimizations, but doesn't seem to be a problem right now.

For these reasons I don't think these fixes should be backported to 2.5.3.
msg76821 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-12-03 09:54
See also issue 4497 for some compiler warnings that need to be silenced.
msg80456 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-01-24 16:01
Fixed in r68890, r68891, r68895 and r68896
Date User Action Args
2022-04-11 14:56:41adminsetgithub: 48643
2009-01-24 16:01:56mark.dickinsonsetstatus: open -> closed
messages: + msg80456
2008-12-03 09:54:42mark.dickinsonsetassignee: mark.dickinson
messages: + msg76821
2008-11-23 12:28:25mark.dickinsoncreate