Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 74497:a321ffb21367
Fix a memory leak when initializing the standard I/O streams.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Wed, 18 Jan 2012 15:28:38 +0100 |
| parents | 87331661042b 93e86b9318f7 |
| children | 2bd7f40108b4 |
comparison
equal
deleted
inserted
replaced
| 74495:b86b54fcb5c2 | 74497:a321ffb21367 |
|---|---|
| 1030 encoding_attr = PyObject_GetAttrString(std, "encoding"); | 1030 encoding_attr = PyObject_GetAttrString(std, "encoding"); |
| 1031 if (encoding_attr != NULL) { | 1031 if (encoding_attr != NULL) { |
| 1032 const char * encoding; | 1032 const char * encoding; |
| 1033 encoding = _PyUnicode_AsString(encoding_attr); | 1033 encoding = _PyUnicode_AsString(encoding_attr); |
| 1034 if (encoding != NULL) { | 1034 if (encoding != NULL) { |
| 1035 _PyCodec_Lookup(encoding); | 1035 PyObject *codec_info = _PyCodec_Lookup(encoding); |
| 1036 Py_XDECREF(codec_info); | |
| 1036 } | 1037 } |
| 1037 Py_DECREF(encoding_attr); | 1038 Py_DECREF(encoding_attr); |
| 1038 } | 1039 } |
| 1039 PyErr_Clear(); /* Not a fatal error if codec isn't available */ | 1040 PyErr_Clear(); /* Not a fatal error if codec isn't available */ |
| 1040 | 1041 |
