[PyObjC-svn] r2501 - trunk/pyobjc/pyobjc-core/Lib/objc

[email protected] Tue, 29 Jun 2010 09:50:48 -0500
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Tue Jun 29 09:50:47 2010
New Revision: 2501

Log:
Tweak compatibility code for the list interface
for NSArray/NSMutableArray: setting and setting
slices now behaves correctly.


Modified:
   trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py

Modified: trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py	(original)
+++ trunk/pyobjc/pyobjc-core/Lib/objc/_convenience.py	Tue Jun 29 09:50:47 2010
@@ -431,6 +431,7 @@
     return container_unwrap(self.objectAtIndex_(idx), RuntimeError)
 
 def __getslice__objectAtIndex_(self, i, j):
+    i = max(i, 0); j = max(j, 0)
     return __getitem__objectAtIndex_(self, slice(i, j))
 
 CONVENIENCE_METHODS[b'objectAtIndex:'] = (
@@ -547,6 +548,8 @@
         self.replaceObjectAtIndex_withObject_(idx, anObject)
 
 def __setslice__replaceObjectAtIndex_withObject_(self, i, j, seq):
+    i = max(i, 0)
+    j = max(j, 0)
     __setitem__replaceObjectAtIndex_withObject_(self, slice(i, j), seq)
 
 CONVENIENCE_METHODS[b'replaceObjectAtIndex:withObject:'] = (

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first