[Patches] [ python-Patches-682514 ] mmapmodule.c write fix for LP64 executables
SourceForge.net
noreply@sourceforge.net
Fri, 07 Feb 2003 11:53:18 -0800
Patches item #682514, was opened at 2003-02-07 14:29
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=682514&group_id=5470
Category: Modules
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Robert Ledwith (rledwith)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: mmapmodule.c write fix for LP64 executables
Initial Comment:
mmap.write will not work correctly in LP64 executables.
Python's "mmap.write(string)" will fail on any platform
where in C: "sizeof(int) != sizeof(long)".
The problem is that mmap_write_method defines "length"
as a "long", but then calls
"PyArg_ParseTuple (args, "s#:write", &data, &length)"
The called function expects that the fourth argument
is to be the address of an "int", not a "long". While
on ILP32 (integers-longs-pointers are 32 bits)
platforms this works correctly, on LP64 (longs-pointers
are 64 bits) platforms, only 32 bits of the variable
are set. The other 32 bits contain trash.
Defining the variable as an "int" fixes the problem
for all platforms. I reviewed the Python 2.3a1
source distribution and found only this single instance
of misusing a long when call "PyArg_ParseTuple".
The patch is a context diff using CVS revision 2.42 of
mmapmodule.c, which is the current version as of Feb 7,
2003.
I believe that this should also be back-ported to 2.2
if another bug fix 2.2 release is made.
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-07 14:53
Message:
Logged In: YES
user_id=33168
Thanks!
Checked in as:
* Modules/mmapmodule.c 2.43 and 2.35.6.5
----------------------------------------------------------------------
Comment By: Robert Ledwith (rledwith)
Date: 2003-02-07 14:32
Message:
Logged In: YES
user_id=707099
There's no uploaded file! You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file.
Please try again.
(This is a SourceForge annoyance that we can do
nothing about. :-( )
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=682514&group_id=5470