cpython: d6ad9d7468f7 (original) (raw)

Mercurial > cpython

changeset 84057:d6ad9d7468f7

Issue #15528: Delay importing atexit until weakref.finalize() used. [#15528]

Richard Oudkerk shibturn@gmail.com
date Sat, 08 Jun 2013 16:52:29 +0100
parents 0be613638523
children d1b5e41acf28
files Lib/weakref.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-)[+] [-] Lib/weakref.py 10

line wrap: on

line diff

--- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -23,7 +23,6 @@ from _weakrefset import WeakSet, _Iterat import collections # Import after _weakref to avoid circular import. import sys import itertools -import atexit ProxyTypes = (ProxyType, CallableProxyType) @@ -464,11 +463,18 @@ class finalize: _shutdown = False _index_iter = itertools.count() _dirty = False

class _Info: slots = ("weakref", "func", "args", "kwargs", "atexit", "index") def init(self, obj, func, *args, **kwargs):

@@ -569,5 +575,3 @@ class finalize: finalize._shutdown = True if reenable_gc: gc.enable() - -atexit.register(finalize._exitfunc)