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/2004-November/049776.html below:

[Python-Dev] Re: weakref gc semantics

[Python-Dev] Re: weakref gc semantics [Python-Dev] Re: weakref gc semanticsNeil Schemenauer nas at arctrix.com
Thu Nov 4 18:38:35 CET 2004
On Thu, Nov 04, 2004 at 12:25:32AM -0500, Tim Peters wrote:
> One I sketched last time, and is in the attached patch-callback.txt. 
> (Patches here just have gcmodule.c code changes, no corresponding
> changes to comments.)  The difference is that it invokes a callback on
> a weakref to trash iff the callback is reachable, instead of invoking
> a callback on a weakref to trash iff the weakref it's attached to is
> reachable.

I like this idea best.  I don't see why it should be hard to
explain.  Instead of saying:

    If you want the weakref callback to be invoked, ensure the
    WEAKREF outlives the referent.

we say:

    If you want the weakref callback to be invoked, ensure the
    CALLBACK outlives the referent.

I think there may be one small problem though.  Callbacks get passed
the weakref object.  Doesn't that break the rule that trash should
not be exposed to Python code while the collection is taking place?

  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