Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 76362:9d8839289e18
Fix another refleak
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Mon, 16 Apr 2012 22:06:21 +0200 |
| parents | a3e9d5c239c4 |
| children | 3b5b4b4bb43c |
line wrap: on
line diff
--- a/Python/import.c Mon Apr 16 21:52:45 2012 +0200 +++ b/Python/import.c Mon Apr 16 22:06:21 2012 +0200 @@ -2881,11 +2881,15 @@ Py_INCREF(final_mod); } else { - Py_ssize_t cut_off = PyUnicode_GetLength(name) - - PyUnicode_GetLength(front); - Py_ssize_t abs_name_len = PyUnicode_GetLength(abs_name); + Py_ssize_t cut_off = PyUnicode_GET_LENGTH(name) - + PyUnicode_GET_LENGTH(front); + Py_ssize_t abs_name_len = PyUnicode_GET_LENGTH(abs_name); PyObject *to_return = PyUnicode_Substring(abs_name, 0, abs_name_len - cut_off); + Py_DECREF(front); + if (to_return == NULL) { + goto error_with_unlock; + } final_mod = PyDict_GetItem(interp->modules, to_return); Py_DECREF(to_return);
