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/2003-May/035671.html below:

[Python-Dev] C new-style classes and GC

[Python-Dev] C new-style classes and GC [Python-Dev] C new-style classes and GCGuido van Rossum guido@python.org
Fri, 16 May 2003 13:37:21 -0400
> It's not clear to me what the one right way to implement a tp_dealloc
> slot is.  I've seen two common patterns in the Python source: call
> obj->ob_type->tp_free or call PyObject_GC_Del.  The type object
> initializes tp_free to PyObject_GC_Del, so in most cases the two
> spellings are equivalent.  Calling PyObject_GC_Del feels more
> straightforward to me.

But calling tp_free is more correct.  This allows a subclass to change
the memory allocation policy.  (This is also important if a base class
is not collectible but a subclass is -- then it's essential that the
base class dealloc handler calls tp_free.)

--Guido van Rossum (home page: http://www.python.org/~guido/)



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