Skip to main content

release_local

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, one always has to retain
a reference to the underlying local object in order to be able
to release it.

Example:
> > > loc = Local()
> > > loc.foo = 42
> > > release_local(loc)
> > > hasattr(loc, 'foo')
False
def release_local(
local: Union[Local, LocalStack]
) - > null

Release the contents of the local for the current context. This makes it possible to use locals without a manager.

Parameters

NameTypeDescription
localUnion[Local, LocalStack]The local or stack object whose data should be cleared for the current execution context.

Returns

TypeDescription
nullNothing is returned; the local storage for the current context is cleared as a side effect.