[Python-checkins] r70684 - python/trunk/Objects/unicodeobject.c

mark.dickinson python-checkins at python.org
Sun Mar 29 18:24:30 CEST 2009


Author: mark.dickinson
Date: Sun Mar 29 18:24:29 2009
New Revision: 70684
Log:
Issue #532631: Apply floatformat changes to unicodeobject.c
as well as stringobject.c.
Modified:
 python/trunk/Objects/unicodeobject.c
Modified: python/trunk/Objects/unicodeobject.c
==============================================================================
--- python/trunk/Objects/unicodeobject.c	(original)
+++ python/trunk/Objects/unicodeobject.c	Sun Mar 29 18:24:29 2009
@@ -8286,6 +8286,15 @@
 return -1;
 if (prec < 0)
 prec = 6;
+ /* make sure that the decimal representation of precision really does
+ need at most 10 digits: platforms with sizeof(int) == 8 exist! */
+ if (prec > 0x7fffffffL) {
+ PyErr_SetString(PyExc_OverflowError,
+ "outrageously large precision "
+ "for formatted float");
+ return -1;
+ }
+
 if (type == 'f' && fabs(x) >= 1e50)
 type = 'g';
 /* Worst case length calc to ensure no buffer overrun:


More information about the Python-checkins mailing list

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