[pypy-svn] r43321 - in pypy/branch/pypy-string-formatting/objspace/std: . test
arigo at codespeak.net
arigo at codespeak.net
Sun May 13 23:25:45 CEST 2007
Author: arigo
Date: Sun May 13 23:25:44 2007
New Revision: 43321
Modified:
pypy/branch/pypy-string-formatting/objspace/std/formatting.py
pypy/branch/pypy-string-formatting/objspace/std/test/test_stringformat.py
Log:
Bug and test.
Modified: pypy/branch/pypy-string-formatting/objspace/std/formatting.py
==============================================================================
--- pypy/branch/pypy-string-formatting/objspace/std/formatting.py (original)
+++ pypy/branch/pypy-string-formatting/objspace/std/formatting.py Sun May 13 23:25:44 2007
@@ -151,7 +151,12 @@
i0 = i
pcount = 1
while 1:
- c = fmt[i]
+ try:
+ c = fmt[i]
+ except IndexError:
+ space = self.space
+ raise OperationError(space.w_ValueError,
+ space.wrap("incomplete format key"))
if c == ')':
pcount -= 1
if pcount == 0:
Modified: pypy/branch/pypy-string-formatting/objspace/std/test/test_stringformat.py
==============================================================================
--- pypy/branch/pypy-string-formatting/objspace/std/test/test_stringformat.py (original)
+++ pypy/branch/pypy-string-formatting/objspace/std/test/test_stringformat.py Sun May 13 23:25:44 2007
@@ -128,6 +128,7 @@
def test_incomplete_format(self):
raises(ValueError, '%'.__mod__, ((23,),))
+ raises(ValueError, '%('.__mod__, ({},))
def test_format_char(self):
assert '%c' % 65 == 'A'
More information about the Pypy-commit
mailing list