INNER CODE UNIT · Python
__setattr__
micronaut-projects/micronaut-core · context-python/src/main/resources/META-INF/GRAALPY-VFS/micronaut-application/src/micronaut_asyncio.py:97
def __setattr__(self, name, value):
by_thread = object.__getattribute__(self, "_by_thread")
defaults = object.__getattribute__(self, "_defaults")
ident = threading.get_ident()
values = by_thread.get(ident)
if value == defaults.get(name, _UNSET):
# back to the default: the thread's entry is dropped, not kept
if values is not None:
values.pop(name, None)
if not values:
by_thread.pop(ident, None)
return
if values is None:
values = by_thread[ident] = {}
values[name] = value
_UNSET = object()