[pypy-svn] r51310 - pypy/branch/ghop-ropes-classes/pypy/rlib

vinogradov at codespeak.net vinogradov at codespeak.net
Wed Feb 6 07:47:26 CET 2008


Author: vinogradov
Date: Wed Feb  6 07:47:23 2008
New Revision: 51310

Modified:
   pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py
Log:
Update implementation of find method

Modified: pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py
==============================================================================
--- pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py	(original)
+++ pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py	Wed Feb  6 07:47:23 2008
@@ -50,12 +50,19 @@
         raise NotImplementedError("Index type not known.")
     
     def find(self, sub):
+        data = None
+	
         if isinstance(sub, str):
             data = RopeString(sub)
         if isinstance(sub, unicode):
             data = RopeUnicode(sub)
-        
-        return rope.find(self._node, data._node)
+	if isinstance(sub, RopeBaseString):
+            data = sub
+	
+	if data:
+            return rope.find(self._node, data._node)
+	else:
+            raise TypeError("expected a character buffer object")
         
 class RopeStringIterator(object):
     def __init__(self, node):



More information about the Pypy-commit mailing list