[pypy-svn] r51403 - pypy/dist/pypy/objspace/std

fijal at codespeak.net fijal at codespeak.net
Tue Feb 12 10:14:09 CET 2008


Author: fijal
Date: Tue Feb 12 10:14:07 2008
New Revision: 51403

Modified:
   pypy/dist/pypy/objspace/std/stringobject.py
Log:
Use a proper exception signature. The thing is that such errors are extremely
hard to debug due to strange errors in normalize_exception.


Modified: pypy/dist/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stringobject.py	(original)
+++ pypy/dist/pypy/objspace/std/stringobject.py	Tue Feb 12 10:14:07 2008
@@ -44,8 +44,12 @@
             if ord(s[i]) > 127:
                 raise OperationError(
                     space.w_UnicodeDecodeError,
-                    space.wrap(("'ascii' codec can't decode byte %s in position %s:"
-                                " ordinal not in range(128)") % (hex(ord(s[i])), i)))
+                    space.newtuple([
+                    space.wrap('ascii'),
+                    space.wrap(s),
+                    space.wrap(i),
+                    space.wrap(i+1),
+                    space.wrap("ordinal not in range(128)")]))
 
 def unicode_w__String(space, w_self):
     # XXX should this use the default encoding?



More information about the Pypy-commit mailing list