(self)
| 26 | __slots__ = 'key', 'dicts', 'localargs', 'locallock', '__weakref__' |
| 27 | |
| 28 | def __init__(self): |
| 29 | # The key used in the Thread objects' attribute dicts. |
| 30 | # We keep it a string for speed but make it unlikely to clash with |
| 31 | # a "real" attribute. |
| 32 | self.key = '_threading_local._localimpl.' + str(id(self)) |
| 33 | # { id(Thread) -> (ref(Thread), thread-local dict) } |
| 34 | self.dicts = {} |
| 35 | |
| 36 | def get_dict(self): |
| 37 | """Return the dict for the current thread. Raises KeyError if none |