[Python-3000-checkins] r57670 - python/branches/py3k/Objects/stringlib/formatter.h

guido.van.rossum python-3000-checkins at python.org
Wed Aug 29 20:42:15 CEST 2007


Author: guido.van.rossum
Date: Wed Aug 29 20:42:15 2007
New Revision: 57670

Modified:
   python/branches/py3k/Objects/stringlib/formatter.h
Log:
Patch # 1048 by Amaury Forgeot d'Arc.
test_float crashes on Windows, because the %zd format is used in a call
to PyOS_snprintf().
The attached patch properly uses PY_FORMAT_SIZE_T.


Modified: python/branches/py3k/Objects/stringlib/formatter.h
==============================================================================
--- python/branches/py3k/Objects/stringlib/formatter.h	(original)
+++ python/branches/py3k/Objects/stringlib/formatter.h	Wed Aug 29 20:42:15 2007
@@ -694,7 +694,7 @@
     /* cast "type", because if we're in unicode we need to pass a
        8-bit char.  this is safe, because we've restricted what "type"
        can be */
-    PyOS_snprintf(fmt, sizeof(fmt), "%%.%zd%c", precision, (char)type);
+    PyOS_snprintf(fmt, sizeof(fmt), "%%.%" PY_FORMAT_SIZE_T "d%c", precision, (char)type);
 
     /* call the passed in function to do the actual formatting */
     snprintf(charbuf, sizeof(charbuf), fmt, x);


More information about the Python-3000-checkins mailing list