MCPcopy Index your code
hub / github.com/RustPython/RustPython / _instantiate

Method _instantiate

Lib/pickle.py:1598–1608  ·  view source on GitHub ↗
(self, klass, args)

Source from the content-addressed store, hash-verified

1596 # klass is the class to instantiate, and k points to the topmost mark
1597 # object, following which are the arguments for klass.__init__.
1598 def _instantiate(self, klass, args):
1599 if (args or not isinstance(klass, type) or
1600 hasattr(klass, "__getinitargs__")):
1601 try:
1602 value = klass(*args)
1603 except TypeError as err:
1604 raise TypeError("in constructor for %s: %s" %
1605 (klass.__name__, str(err)), err.__traceback__)
1606 else:
1607 value = klass.__new__(klass)
1608 self.append(value)
1609
1610 def load_inst(self):
1611 module = self.readline()[:-1].decode("ascii")

Callers 2

load_instMethod · 0.95
load_objMethod · 0.95

Calls 5

isinstanceFunction · 0.85
hasattrFunction · 0.85
strFunction · 0.85
__new__Method · 0.45
appendMethod · 0.45

Tested by

no test coverage detected