[docs] [issue19047] Assorted weakref docs improvements

Richard Oudkerk report at bugs.python.org
Sun Sep 22 21:13:00 CEST 2013

Richard Oudkerk added the comment:

Thanks for the doc cleanup -- I am rather busy right now.

Note that stuff does still get replaced by None at shutdown, and this can still produce errors, even if they are much harder to trigger.  If I run the following program

    import _weakref
    import collections

    a = "hello"

    class Foo(object):
        def __del__(self):

    collections.foo = Foo()
    _weakref.foo = Foo()

then depending on the initial hashseed I get a reproducible error:

    $ PYTHONHASHSEED=7 python-release /tmp/bad.py
    Exception ignored in: <bound method Foo.__del__ of <__main__.Foo object at 0xb733db8c>>
    Traceback (most recent call last):
      File "/tmp/bad.py", line 8, in __del__
    TypeError: 'NoneType' object is not callable

(Personally I would like to see a flag set late during shutdown which blocks __del__ methods from running.)


Python tracker <report at bugs.python.org>

More information about the docs mailing list