A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-July/046097.html below:

[Python-Dev] Proposal: C API Macro to decref and set to NULL

[Python-Dev] Proposal: C API Macro to decref and set to NULL [Python-Dev] Proposal: C API Macro to decref and set to NULLSkip Montanaro skip at pobox.com
Tue Jul 13 04:36:32 CEST 2004
    Jim> The correct way to do this is something like:

    Jim>    tmp = self->foo;
    Jim>    self-> foo = NULL;
    Jim>    Py_XDECREF(tmp);

    Jim> I suggest that there should be a standard macro to automate this.

    Jim>    Py_CLEAR(self->foo)

    Jim> This would be defined to be the same result as Py_XDECREF except
    Jim> that the argument will be set to NULL.

    Jim> Thoughts?

Just my two cents, but the name suggests to me that it's doing more than a
simple decref and set to NULL.  I can't think of anything else off the top
of my head that seems obviously better though.

Skip
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