[Python-checkins] r74269 - python/trunk/Objects/stringlib/formatter.h

eric.smith python-checkins at python.org
Thu Jul 30 15:39:45 CEST 2009


Author: eric.smith
Date: Thu Jul 30 15:39:44 2009
New Revision: 74269
Log:
Issue 6330: Fix --enable-unicode=ucs4.
Modified:
 python/trunk/Objects/stringlib/formatter.h
Modified: python/trunk/Objects/stringlib/formatter.h
==============================================================================
--- python/trunk/Objects/stringlib/formatter.h	(original)
+++ python/trunk/Objects/stringlib/formatter.h	Thu Jul 30 15:39:44 2009
@@ -32,7 +32,7 @@
 PyErr_Format(PyExc_ValueError,
 "Unknown format code '%c' "
 "for object of type '%.200s'",
- presentation_type,
+ (char)presentation_type,
 type_name);
 #if STRINGLIB_IS_UNICODE
 else
@@ -44,6 +44,24 @@
 #endif
 }
 
+static void
+invalid_comma_type(STRINGLIB_CHAR presentation_type)
+{
+#if STRINGLIB_IS_UNICODE
+ /* See comment in unknown_presentation_type */
+ if (presentation_type > 32 && presentation_type < 128)
+#endif
+ PyErr_Format(PyExc_ValueError,
+ "Cannot specify ',' with '%c'.",
+ (char)presentation_type);
+#if STRINGLIB_IS_UNICODE
+ else
+ PyErr_Format(PyExc_ValueError,
+ "Cannot specify ',' with '\\x%x'.",
+ (unsigned int)presentation_type);
+#endif
+}
+
 /*
 get_integer consumes 0 or more decimal digit characters from an
 input string, updates *result with the corresponding positive
@@ -253,8 +271,7 @@
 /* These are allowed. See PEP 378.*/
 break;
 default:
- PyErr_Format(PyExc_ValueError,
- "Cannot specify ',' with '%c'.", format->type);
+ invalid_comma_type(format->type);
 return 0;
 }
 }


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /