Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 65762:ea14977a36de
Issue #10157: Fixed refleaks in pythonrun.c. Patch by Stefan Krah.
| author | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> |
|---|---|
| date | Sat, 30 Oct 2010 15:08:15 +0000 |
| parents | 6ac18576e8fa |
| children | 06f76ef27f86 |
comparison
equal
deleted
inserted
replaced
| 65761:e6af146bb38b | 65762:ea14977a36de |
|---|---|
| 281 pstderr = PyFile_NewStdPrinter(fileno(stderr)); | 281 pstderr = PyFile_NewStdPrinter(fileno(stderr)); |
| 282 if (pstderr == NULL) | 282 if (pstderr == NULL) |
| 283 Py_FatalError("Py_Initialize: can't set preliminary stderr"); | 283 Py_FatalError("Py_Initialize: can't set preliminary stderr"); |
| 284 PySys_SetObject("stderr", pstderr); | 284 PySys_SetObject("stderr", pstderr); |
| 285 PySys_SetObject("__stderr__", pstderr); | 285 PySys_SetObject("__stderr__", pstderr); |
| 286 Py_DECREF(pstderr); | |
| 286 | 287 |
| 287 _PyImport_Init(); | 288 _PyImport_Init(); |
| 288 | 289 |
| 289 _PyImportHooks_Init(); | 290 _PyImportHooks_Init(); |
| 290 | 291 |
| 603 pstderr = PyFile_NewStdPrinter(fileno(stderr)); | 604 pstderr = PyFile_NewStdPrinter(fileno(stderr)); |
| 604 if (pstderr == NULL) | 605 if (pstderr == NULL) |
| 605 Py_FatalError("Py_Initialize: can't set preliminary stderr"); | 606 Py_FatalError("Py_Initialize: can't set preliminary stderr"); |
| 606 PySys_SetObject("stderr", pstderr); | 607 PySys_SetObject("stderr", pstderr); |
| 607 PySys_SetObject("__stderr__", pstderr); | 608 PySys_SetObject("__stderr__", pstderr); |
| 609 Py_DECREF(pstderr); | |
| 608 | 610 |
| 609 _PyImportHooks_Init(); | 611 _PyImportHooks_Init(); |
| 610 if (initstdio() < 0) | 612 if (initstdio() < 0) |
| 611 Py_FatalError( | 613 Py_FatalError( |
| 612 "Py_Initialize: can't initialize sys standard streams"); | 614 "Py_Initialize: can't initialize sys standard streams"); |
| 969 const char * encoding; | 971 const char * encoding; |
| 970 encoding = _PyUnicode_AsString(encoding_attr); | 972 encoding = _PyUnicode_AsString(encoding_attr); |
| 971 if (encoding != NULL) { | 973 if (encoding != NULL) { |
| 972 _PyCodec_Lookup(encoding); | 974 _PyCodec_Lookup(encoding); |
| 973 } | 975 } |
| 976 Py_DECREF(encoding_attr); | |
| 974 } | 977 } |
| 975 PyErr_Clear(); /* Not a fatal error if codec isn't available */ | 978 PyErr_Clear(); /* Not a fatal error if codec isn't available */ |
| 976 | 979 |
| 977 PySys_SetObject("__stderr__", std); | 980 PySys_SetObject("__stderr__", std); |
| 978 PySys_SetObject("stderr", std); | 981 PySys_SetObject("stderr", std); |
