[pypy-svn] r23802 - pypy/dist/pypy/translator/c
arigo at codespeak.net
arigo at codespeak.net
Wed Mar 1 01:48:38 CET 2006
Author: arigo
Date: Wed Mar 1 01:48:32 2006
New Revision: 23802
Modified:
pypy/dist/pypy/translator/c/symboltable.py
Log:
debugging-symbol support for arrays that don't store their own length.
Modified: pypy/dist/pypy/translator/c/symboltable.py
==============================================================================
--- pypy/dist/pypy/translator/c/symboltable.py (original)
+++ pypy/dist/pypy/translator/c/symboltable.py Wed Mar 1 01:48:32 2006
@@ -142,13 +142,18 @@
ARRAY = self._TYPE.TO
if isinstance(ARRAY, Array):
length_offset = self._nth_offset(0)
+ if length_offset == -1:
+ raise TypeError, "array has no stored length: %r" % (ARRAY,)
return self._read(Signed, length_offset)
raise TypeError, "not an array: %r" % (ARRAY,)
def __getitem__(self, index):
ARRAY = self._TYPE.TO
if isinstance(ARRAY, Array):
- if not (0 <= index < len(self)):
+ length_offset = self._nth_offset(0)
+ if length_offset == -1:
+ pass # just assume the access is within bounds
+ elif not (0 <= index < len(self)):
raise IndexError("array index out of bounds")
item0_offset = self._nth_offset(1)
item1_offset = self._nth_offset(2)
More information about the Pypy-commit
mailing list