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

ale at codespeak.net ale at codespeak.net
Tue Jun 7 22:20:02 CEST 2005


Author: ale
Date: Tue Jun  7 22:20:00 2005
New Revision: 13166

Modified:
   pypy/dist/pypy/objspace/std/unicodeobject.py
Log:
Added a type check to .encode. I am not quite sure if this is the right place to do the check.

Modified: pypy/dist/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/unicodeobject.py	Tue Jun  7 22:20:00 2005
@@ -781,7 +781,9 @@
         retval, lenght = encoder(unistr)
     else:
         retval, length = encoder(unistr, errors)
-
+    if not isinstance(retval,str):
+        raise TypeError("encoder did not return an unicode object (type=%s)" %
+                        type(retval).__name__)
     return retval
 
 ''')



More information about the Pypy-commit mailing list