30.11.17 17:42, Victor Stinner пише:
CPython has many C extensions with non-trivial PyInit_xxx() functions
which has to handle failures. A few modules use "Py_DECREF(m); retutrn
NULL;", but most functions only do "return NULL;". Is it a reference
leak or not?

Example from Modules/posixmodule.c:

     v = convertenviron();
     Py_XINCREF(v);
     if (v == NULL || PyModule_AddObject(m, "environ", v) != 0)
         return NULL;
     Py_DECREF(v);

Does this code leak a reference on m? ... Oh, and maybe also leaks a
reference on v?

https://mail.python.org/pipermail/python-dev/2016-April/144359.html
https://bugs.python.org/issue26871

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to