cpython: 7140d97d36fd (original) (raw)
Mercurial > cpython
changeset 78178:7140d97d36fd 3.2
Issue #15394: Fix ref leaks in PyModule_Create. Patch by Julia Lawall. [#15394]
Meador Inge meadori@gmail.com | |
---|---|
date | Thu, 19 Jul 2012 13:45:43 -0500 |
parents | 153ae76b963e |
children | 571777bf5527 b584c58c2286 |
files | Misc/ACKS Misc/NEWS Objects/moduleobject.c |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-)[+] [-] Misc/ACKS 1 Misc/NEWS 3 Objects/moduleobject.c 8 |
line wrap: on
line diff
--- a/Misc/ACKS +++ b/Misc/ACKS @@ -542,6 +542,7 @@ Soren Larsen Piers Lauder Ben Laurie Simon Law +Julia Lawall Chris Lawrence Brian Leair James Lee
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.2.4 Core and Builtins ----------------- +- Issue #15394: An issue in PyModule_Create that caused references to
- Issue #15368: An issue that caused bytecode generation to be non-deterministic when using randomized hashing (-R) has been fixed.
--- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -117,8 +117,10 @@ PyModule_Create2(struct PyModuleDef* mod d = PyModule_GetDict((PyObject*)m); if (module->m_methods != NULL) { n = PyUnicode_FromString(name);
if (n == NULL)[](#l3.7)
if (n == NULL) {[](#l3.8)
Py_DECREF(m);[](#l3.9) return NULL;[](#l3.10)
}[](#l3.11) for (ml = module->m_methods; ml->ml_name != NULL; ml++) {[](#l3.12) if ((ml->ml_flags & METH_CLASS) ||[](#l3.13) (ml->ml_flags & METH_STATIC)) {[](#l3.14)
@@ -126,16 +128,19 @@ PyModule_Create2(struct PyModuleDef* mod "module functions cannot set" " METH_CLASS or METH_STATIC"); Py_DECREF(n);
Py_DECREF(m);[](#l3.19) return NULL;[](#l3.20) }[](#l3.21) v = PyCFunction_NewEx(ml, (PyObject*)m, n);[](#l3.22) if (v == NULL) {[](#l3.23) Py_DECREF(n);[](#l3.24)
Py_DECREF(m);[](#l3.25) return NULL;[](#l3.26) }[](#l3.27) if (PyDict_SetItemString(d, ml->ml_name, v) != 0) {[](#l3.28) Py_DECREF(v);[](#l3.29) Py_DECREF(n);[](#l3.30)
Py_DECREF(m);[](#l3.31) return NULL;[](#l3.32) }[](#l3.33) Py_DECREF(v);[](#l3.34)
@@ -146,6 +151,7 @@ PyModule_Create2(struct PyModuleDef* mod v = PyUnicode_FromString(module->m_doc); if (v == NULL || PyDict_SetItemString(d, "doc", v) != 0) { Py_XDECREF(v);
Py_DECREF(m);[](#l3.39) return NULL;[](#l3.40) }[](#l3.41) Py_DECREF(v);[](#l3.42)