[pypy-svn] r5615 - pypy/trunk/src/pypy/objspace/std

mwh at codespeak.net mwh at codespeak.net
Thu Jul 22 17:57:41 CEST 2004


Author: mwh
Date: Thu Jul 22 17:57:40 2004
New Revision: 5615

Modified:
   pypy/trunk/src/pypy/objspace/std/stringobject.py
Log:
error checking in ord()


Modified: pypy/trunk/src/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/stringobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/stringobject.py	Thu Jul 22 17:57:40 2004
@@ -969,6 +969,11 @@
 
     
 def ord__String(space, w_str):
+    if len(w_str._value) != 1:
+        raise OperationError(
+            space.w_TypeError,
+            space.wrap("ord() expected a character, but string "
+                       "of length %d found"%(len(w_str._value),)))
     return space.wrap(ord(space.unwrap(w_str)))
 
 def app_mod__String_ANY(format, values):



More information about the Pypy-commit mailing list