[pypy-svn] r14090 - pypy/dist/pypy/lib
gintas at codespeak.net
gintas at codespeak.net
Sat Jul 2 14:20:58 CEST 2005
Author: gintas
Date: Sat Jul 2 14:20:58 2005
New Revision: 14090
Modified:
pypy/dist/pypy/lib/_formatting.py
Log:
Fixed a bug.
E.g., u"%\u0105" % 1 would crash the interpreter.
Modified: pypy/dist/pypy/lib/_formatting.py
==============================================================================
--- pypy/dist/pypy/lib/_formatting.py (original)
+++ pypy/dist/pypy/lib/_formatting.py Sat Jul 2 14:20:58 2005
@@ -453,9 +453,12 @@
try:
f = format_registry[t[0]]
except KeyError:
+ char = t[0]
+ if isinstance(char, unicode):
+ char = char.encode(sys.getdefaultencoding(), 'replace')
raise ValueError("unsupported format character "
"'%s' (0x%x) at index %d"
- %(t[0], ord(t[0]), fmtiter.i-1))
+ % (char, ord(t[0]), fmtiter.i - 1))
# Trying to translate this using the flow space.
# Currently, star args give a problem there,
# so let's be explicit about the args:
More information about the Pypy-commit
mailing list