celery.utils.dispatch.saferef
“Safe weakrefs”, originally from pyDispatcher.
Provides a way to safely weakref any function, including bound methods (which aren’t handled by the core weakref module).
celery.utils.dispatch.saferef.safe_ref(target, on_delete=None)[源代码]
Return a safe weak reference to a callable target
参数: | - target – the object to be weakly referenced, if it’s a bound method reference, will create a BoundMethodWeakref, otherwise creates a simple weakref.ref.
- on_delete – if provided, will have a hard reference stored to the callable to be called after the safe reference goes out of scope with the reference object, (either a weakref.ref or a BoundMethodWeakref) as argument.
|
---|