[Patches] [ python-Patches-552438 ] PyBufferObject fixes

noreply@sourceforge.net noreply@sourceforge.net
Sat, 04 May 2002 21:26:05 -0700


Patches item #552438, was opened at 2002-05-05 04:26
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=552438&group_id=5470

Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Scott Gilbert (xscott)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyBufferObject fixes

Initial Comment:
This patch fixes these problems:

  1) Dangling pointer problem
  2) buffer allocated by PyBuffer_New not aligned

The PyBufferObject acts differently depending on 
whether it allocated the memory or if it's borrowing 
the memory from a PyBufferProcs supporting object.

In the case of allocating it's own memory, I made a 
slight addition that adds some padding so that the ptr 
is on a sizeof(double) boundary.

In the case of borrowing another objects PyBufferProcs 
memory, PyBufferObject no longer caches the pointer.  
This might slow things down (probably not by much), 
but it keeps PyBufferObject from working with a stale 
pointer.


Normally I wouldn't do this, but since this patch 
touches pretty much every function anyway, I fixed 
many deviations from the Python coding style.



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=552438&group_id=5470