MCPcopy Index your code
hub / github.com/python/cpython / __new__

Method __new__

Lib/_threading_local.py:85–97  ·  view source on GitHub ↗
(cls, /, *args, **kw)

Source from the content-addressed store, hash-verified

83 __slots__ = '_local__impl', '__dict__'
84
85 def __new__(cls, /, *args, **kw):
86 if (args or kw) and (cls.__init__ is object.__init__):
87 raise TypeError("Initialization arguments are not supported")
88 self = object.__new__(cls)
89 impl = _localimpl()
90 impl.localargs = (args, kw)
91 impl.locallock = RLock()
92 object.__setattr__(self, '_local__impl', impl)
93 # We need to create the thread dict in anticipation of
94 # __init__ being called, to make sure we don't call it
95 # again ourselves.
96 impl.create_dict()
97 return self
98
99 def __getattribute__(self, name):
100 with _patch(self):

Callers

nothing calls this directly

Calls 4

RLockFunction · 0.90
_localimplClass · 0.85
create_dictMethod · 0.80
__setattr__Method · 0.45

Tested by

no test coverage detected