[pypy-svn] r12145 - pypy/dist/pypy/module/recparser
adim at codespeak.net
adim at codespeak.net
Tue May 10 12:22:35 CEST 2005
Author: adim
Date: Tue May 10 12:22:35 2005
New Revision: 12145
Modified:
pypy/dist/pypy/module/recparser/pythonlexer.py
pypy/dist/pypy/module/recparser/pythonparse.py
Log:
fixed interactive-shell bug (IndexError when dealing with multi-lines input)
Modified: pypy/dist/pypy/module/recparser/pythonlexer.py
==============================================================================
--- pypy/dist/pypy/module/recparser/pythonlexer.py (original)
+++ pypy/dist/pypy/module/recparser/pythonlexer.py Tue May 10 12:22:35 2005
@@ -263,7 +263,11 @@
if not hasattr(self, '_lines'):
# split lines only once
self._lines = self.input.splitlines()
- return 'line %s : %s' % (self.line, self._lines[self.line-1])
+ if self.line > len(self._lines):
+ lineno = len(self._lines)
+ else:
+ lineno = self.line
+ return 'line %s : %s' % (lineno, self._lines[lineno-1])
## ONLY refactor ideas ###########################################
## def _mynext(self):
Modified: pypy/dist/pypy/module/recparser/pythonparse.py
==============================================================================
--- pypy/dist/pypy/module/recparser/pythonparse.py (original)
+++ pypy/dist/pypy/module/recparser/pythonparse.py Tue May 10 12:22:35 2005
@@ -17,7 +17,6 @@
builder._source_encoding = src.encoding
# </HACK>
if not result:
- print src.debug()
raise SyntaxError("at %s" % src.debug() )
return builder
More information about the Pypy-commit
mailing list