[pypy-svn] r5554 - in pypy/trunk/src/pypy: appspace objspace/std

mwh at codespeak.net mwh at codespeak.net
Wed Jul 14 12:29:09 CEST 2004


Author: mwh
Date: Wed Jul 14 12:29:08 2004
New Revision: 5554

Modified:
   pypy/trunk/src/pypy/appspace/_formatting.py
   pypy/trunk/src/pypy/objspace/std/stringobject.py
Log:
make arigo's tests pass
(and that's it: i haven't really attempted to understand anything here)


Modified: pypy/trunk/src/pypy/appspace/_formatting.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/_formatting.py	(original)
+++ pypy/trunk/src/pypy/appspace/_formatting.py	Wed Jul 14 12:29:08 2004
@@ -203,7 +203,8 @@
     except StopIteration:
         pass
     else:
-        raise TypeError('not all arguments converted '
-                        'during string formatting')
+        if valuedict is None:
+            raise TypeError('not all arguments converted '
+                            'during string formatting')
     return ''.join(r)
             

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	Wed Jul 14 12:29:08 2004
@@ -976,8 +976,9 @@
     if isinstance(values, tuple):
         return _formatting.format(format, values, None)
     else:
-        if hasattr(values, '__getitem__') and not isinstance(values, str):
-            return _formatting.format(format, (), values)
+        if hasattr(values, '__getitem__') and \
+               not isinstance(values, (str, list)):
+            return _formatting.format(format, (values,), values)
         else:
             return _formatting.format(format, (values,), None)
 



More information about the Pypy-commit mailing list