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/2008-February/076963.html below:

[Python-Dev] Py_CLEAR to avoid crashes

[Python-Dev] Py_CLEAR to avoid crashes [Python-Dev] Py_CLEAR to avoid crashesNeil Schemenauer nas at arctrix.com
Mon Feb 18 22:52:14 CET 2008
On Mon, Feb 18, 2008 at 05:48:57PM +0100, Amaury Forgeot d'Arc wrote:
> For example, in exception.c, BaseException_init() starts with the instruction:
>     Py_DECREF(self->args);
> this may call __del__ on self->args

Ah, I understand now.  We are not talking about tp_dealloc methods
(the GC takes great pains to avoid this scenario).  However, any
object that calls Py_DECREF outside of its tp_dealloc method must be
prepared for finalizers to access it in arbitrary ways.

That sucks.  Most Py_DECREF calls are probably okay but it's going
to be hard to find the ones that are not.  I can't think of anything
we can do to make this trap harder to fall into.  Even using
Py_CLEAR as a blunt tool is not a total solution. You could still
end up with a null pointer dereference if the code is not written
carefully.

  Neil
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