[pypy-svn] r3332 - pypy/trunk/src/pypy/appspace
sanxiyn at codespeak.net
sanxiyn at codespeak.net
Tue Mar 23 15:58:47 CET 2004
Author: sanxiyn
Date: Tue Mar 23 15:58:43 2004
New Revision: 3332
Modified:
pypy/trunk/src/pypy/appspace/sre_parse.py
Log:
This lets re.compile('a*') work on StdObjSpace.
It didn't work before. (Check yourself.)
It still does not work on TrivialObjSpace, but so what.
The problem was that StdObjSpace does not handle __(get|set|del)slice__ special
methods.
However, those special methods are declared deprecated since 2.0.
See Language Reference section 3.3.6.
Perhaps this should be fixed in CPython too?
Modified: pypy/trunk/src/pypy/appspace/sre_parse.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/sre_parse.py (original)
+++ pypy/trunk/src/pypy/appspace/sre_parse.py Tue Mar 23 15:58:43 2004
@@ -135,11 +135,12 @@
def __delitem__(self, index):
del self.data[index]
def __getitem__(self, index):
- return self.data[index]
+ if isinstance(index, slice):
+ return SubPattern(self.pattern, self.data[index])
+ else:
+ return self.data[index]
def __setitem__(self, index, code):
self.data[index] = code
- def __getslice__(self, start, stop):
- return SubPattern(self.pattern, self.data[start:stop])
def insert(self, index, code):
self.data.insert(index, code)
def append(self, code):
More information about the Pypy-commit
mailing list