[pypy-svn] r16454 - pypy/dist/pypy/interpreter
ale at codespeak.net
ale at codespeak.net
Thu Aug 25 12:08:16 CEST 2005
Author: ale
Date: Thu Aug 25 12:08:15 2005
New Revision: 16454
Modified:
pypy/dist/pypy/interpreter/pycompiler.py
Log:
(ludovic, arre, ale)
Don't convert UnicodeError into ValueError.
Give an error messages explaining that the original exception was before changed into ValueError.
Fixes the last failing test of test_unicode.py
Modified: pypy/dist/pypy/interpreter/pycompiler.py
==============================================================================
--- pypy/dist/pypy/interpreter/pycompiler.py (original)
+++ pypy/dist/pypy/interpreter/pycompiler.py Thu Aug 25 12:08:15 2005
@@ -231,8 +231,16 @@
space.wrap(e.offset),
space.wrap(e.text)])])
raise OperationError(space.w_SyntaxError, w_synerr)
+ except UnicodeDecodeError, e:
+ raise OperationError(space.w_UnicodeDecodeError, space.newtuple([
+ space.wrap(e.encoding), space.wrap(e.object), space.wrap(e.start),
+ space.wrap(e.end), space.wrap(e.reason)]))
except ValueError,e:
- raise OperationError(space.w_ValueError,space.wrap(str(e)))
+ if e.__class__ != ValueError:
+ extra_msg = "(Really go %s)" % e.__class__.__name__
+ else:
+ extra_msg = ""
+ raise OperationError(space.w_ValueError,space.wrap(str(e)+extra_msg))
except TypeError,e:
raise OperationError(space.w_TypeError,space.wrap(str(e)))
# __________ end of XXX above
More information about the Pypy-commit
mailing list