[Python-checkins] r46686 - python/trunk/Python/sysmodule.c

tim.peters python-checkins at python.org
Tue Jun 6 02:25:14 CEST 2006


Author: tim.peters
Date: Tue Jun  6 02:25:07 2006
New Revision: 46686

Modified:
   python/trunk/Python/sysmodule.c
Log:
_PySys_Init():  It's rarely a good idea to size a buffer to the
exact maximum size someone guesses is needed.  In this case, if
we're really worried about extreme integers, then "cp%d" can
actually need 14 bytes (2 for "cp" + 1 for \0 at the end +
11 for -(2**31-1)).  So reserve 128 bytes instead -- nothing is
actually saved by making a stack-local buffer tiny.


Modified: python/trunk/Python/sysmodule.c
==============================================================================
--- python/trunk/Python/sysmodule.c	(original)
+++ python/trunk/Python/sysmodule.c	Tue Jun  6 02:25:07 2006
@@ -1031,7 +1031,7 @@
 	PyObject *sysin, *sysout, *syserr;
 	char *s;
 #ifdef MS_WINDOWS
-	char buf[13];
+	char buf[128];
 #endif
 
 	m = Py_InitModule3("sys", sys_methods, sys_doc);


More information about the Python-checkins mailing list