[pypy-svn] r5614 - pypy/trunk/src/pypy/objspace/std
mwh at codespeak.net
mwh at codespeak.net
Thu Jul 22 17:57:16 CEST 2004
Author: mwh
Date: Thu Jul 22 17:57:15 2004
New Revision: 5614
Modified:
pypy/trunk/src/pypy/objspace/std/stringobject.py
pypy/trunk/src/pypy/objspace/std/stringtype.py
Log:
str.decode()
methods that take optional args but don't take None's as indication
of an absent argument are evil, btw
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:15 2004
@@ -984,6 +984,18 @@
mod__String_ANY = gateway.app2interp(app_mod__String_ANY)
+
+def app_str_decode__String_ANY_ANY(str, encoding=None, errors=None):
+ if encoding is None and errors is None:
+ return unicode(str)
+ elif errors is None:
+ return unicode(str, encoding)
+ else:
+ return unicode(str, encoding, errors)
+
+
+str_decode__String_ANY_ANY = gateway.app2interp(app_str_decode__String_ANY_ANY)
+
# register all methods
from pypy.objspace.std import stringtype
register_all(vars(), stringtype)
Modified: pypy/trunk/src/pypy/objspace/std/stringtype.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/stringtype.py (original)
+++ pypy/trunk/src/pypy/objspace/std/stringtype.py Thu Jul 22 17:57:15 2004
@@ -34,6 +34,7 @@
str_splitlines = MultiMethod('splitlines', 2, defaults=(0,))
str_startswith = MultiMethod('startswith', 2) #[optional arguments not supported now]
str_translate = MultiMethod('translate', 3, defaults=('',)) #unicode mimic not supported now
+str_decode = MultiMethod('decode', 3, defaults=(None, None))
# ____________________________________________________________
More information about the Pypy-commit
mailing list