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/2014-January/132177.html below:

[Python-Dev] Add Py_REPLACE and Py_XREPLACE macros

[Python-Dev] Add Py_REPLACE and Py_XREPLACE macros [Python-Dev] Add Py_REPLACE and Py_XREPLACE macrosSerhiy Storchaka storchaka at gmail.com
Wed Jan 29 19:24:41 CET 2014
The Py_CLEAR macros is used as safe alternative for following unsafe 
idiomatic code:

     Py_XDECREF(ptr);
     ptr = NULL;

But other unsafe idiomatic code is widely used in the sources:

     Py_XDECREF(ptr);
     ptr = new_value;

Every occurrence of such code is potential bug for same reasons as for 
Py_CLEAR.

It was offered [1] to introduce new macros Py_REPLACE and Py_XREPLACE 
for safe replace with Py_DECREF and Py_XDECREF respectively. 
Automatically generated patch contains about 50 replaces [2].

[1] http://bugs.python.org/issue16447
[2] http://bugs.python.org/issue20440

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