A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-November/150982.html below:

[Python-Dev] Py_DECREF(m) on PyInit_xxx() failure?

[Python-Dev] Py_DECREF(m) on PyInit_xxx() failure? [Python-Dev] Py_DECREF(m) on PyInit_xxx() failure?Victor Stinner victor.stinner at gmail.com
Thu Nov 30 10:42:50 EST 2017
Hi,

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?

Victor
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4