[Patches] [ python-Patches-1617699 ] slice-object support for ctypes Pointer/Array

SourceForge.net noreply at sourceforge.net
Mon Jan 15 12:48:53 CET 2007


Patches item #1617699, was opened at 2006-12-18 05:28
Message generated for change (Comment added) made by twouters
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1617699&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Thomas Wouters (twouters)
Assigned to: Thomas Heller (theller)
Summary: slice-object support for ctypes Pointer/Array

Initial Comment:
Support for slicing ctypes' Pointer and Array types with slice objects, although only for step=1 case.
(Backported from p3yk-noslice branch.)


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

>Comment By: Thomas Wouters (twouters)
Date: 2007-01-15 12:48

Message:
Logged In: YES 
user_id=34209
Originator: YES

The point is that simple slicing will go away, and extended slices (with
sliceobjects) are used in various places, and currently can't be passed on
to ctypes arrays and pointers. That is to say, a Python class defining
__getitem__ but not __getslice__ still supports slice syntax, but it can't
do 'pointer[sliceobj]' -- it would have to do
'pointer[sliceobj.start:sliceobj.end]'. Also, because simple slices will go
away, this code will have to be added to the p3yk branch in any case;
having it in the trunk just makes for easier maintenance.

Oh, and the non-support for steps other than 1 is not a fundamental issue,
I just couldn't bear to write the code for that if you didn't think it
would be useful, as I'd already written the same logic and arithmetic for
array, tupleseq, mmap and I forget what else :P You can consider this code
half-done, if you wish; I'll get to it again soon enough.

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

Comment By: Thomas Heller (theller)
Date: 2007-01-12 21:48

Message:
Logged In: YES 
user_id=11105
Originator: NO

Thomas, a question:  Since steps != 1 are not supported, does this patch
have any value?
IIUC, array[x:y] returns exactly the same as array[x:y:1] for all x and y
values.

Formally, the patch is missing unittests and documentation ;-).

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

Comment By: Thomas Heller (theller)
Date: 2006-12-20 19:45

Message:
Logged In: YES 
user_id=11105
Originator: NO

Unfortunately I'm unable to review or work on this patch *this year*.  I
will definitely take a look in January.  Sorry.

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

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


More information about the Patches mailing list