MCPcopy
hub / github.com/celery/celery / release_local

Function release_local

celery/utils/threads.py:94–112  ·  view source on GitHub ↗

Release the contents of the local for the current context. This makes it possible to use locals without a manager. With this function one can release :class:`Local` objects as well as :class:`StackLocal` objects. However it's not possible to release data held by proxies that way,

(local)

Source from the content-addressed store, hash-verified

92
93
94def release_local(local):
95 """Release the contents of the local for the current context.
96
97 This makes it possible to use locals without a manager.
98
99 With this function one can release :class:`Local` objects as well as
100 :class:`StackLocal` objects. However it's not possible to
101 release data held by proxies that way, one always has to retain
102 a reference to the underlying local object in order to be able
103 to release it.
104
105 Example:
106 >>> loc = Local()
107 >>> loc.foo = 42
108 >>> release_local(loc)
109 >>> hasattr(loc, 'foo')
110 False
111 """
112 local.__release_local__()
113
114
115class Local:

Callers 2

popMethod · 0.85
cleanupMethod · 0.85

Calls 1

__release_local__Method · 0.45

Tested by

no test coverage detected