MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / local

Class local

tools/python-3.11.9-amd64/Lib/_threading_local.py:204–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202
203
204class local:
205 __slots__ = '_local__impl', '__dict__'
206
207 def __new__(cls, /, *args, **kw):
208 if (args or kw) and (cls.__init__ is object.__init__):
209 raise TypeError("Initialization arguments are not supported")
210 self = object.__new__(cls)
211 impl = _localimpl()
212 impl.localargs = (args, kw)
213 impl.locallock = RLock()
214 object.__setattr__(self, '_local__impl', impl)
215 # We need to create the thread dict in anticipation of
216 # __init__ being called, to make sure we don't call it
217 # again ourselves.
218 impl.create_dict()
219 return self
220
221 def __getattribute__(self, name):
222 with _patch(self):
223 return object.__getattribute__(self, name)
224
225 def __setattr__(self, name, value):
226 if name == '__dict__':
227 raise AttributeError(
228 "%r object attribute '__dict__' is read-only"
229 % self.__class__.__name__)
230 with _patch(self):
231 return object.__setattr__(self, name, value)
232
233 def __delattr__(self, name):
234 if name == '__dict__':
235 raise AttributeError(
236 "%r object attribute '__dict__' is read-only"
237 % self.__class__.__name__)
238 with _patch(self):
239 return object.__delattr__(self, name)
240
241
242from threading import current_thread, RLock

Callers 1

_mktimeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected