Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 38622:6ae418e4b36a legacy-trunk
_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.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Tue, 06 Jun 2006 00:25:07 +0000 |
| parents | 80a627340c9f |
| children | b6fd499e4343 |
comparison
equal
deleted
inserted
replaced
| 38620:a60adf0cb2fd | 38622:6ae418e4b36a |
|---|---|
| 1029 { | 1029 { |
| 1030 PyObject *m, *v, *sysdict; | 1030 PyObject *m, *v, *sysdict; |
| 1031 PyObject *sysin, *sysout, *syserr; | 1031 PyObject *sysin, *sysout, *syserr; |
| 1032 char *s; | 1032 char *s; |
| 1033 #ifdef MS_WINDOWS | 1033 #ifdef MS_WINDOWS |
| 1034 char buf[13]; | 1034 char buf[128]; |
| 1035 #endif | 1035 #endif |
| 1036 | 1036 |
| 1037 m = Py_InitModule3("sys", sys_methods, sys_doc); | 1037 m = Py_InitModule3("sys", sys_methods, sys_doc); |
| 1038 if (m == NULL) | 1038 if (m == NULL) |
| 1039 return NULL; | 1039 return NULL; |
