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

Method get_extension

Lib/pickle.py:1669–1682  ·  view source on GitHub ↗
(self, code)

Source from the content-addressed store, hash-verified

1667 dispatch[EXT4[0]] = load_ext4
1668
1669 def get_extension(self, code):
1670 obj = _extension_cache.get(code, _NoValue)
1671 if obj is not _NoValue:
1672 self.append(obj)
1673 return
1674 key = _inverted_registry.get(code)
1675 if not key:
1676 if code <= 0: # note that 0 is forbidden
1677 # Corrupt or hostile pickle.
1678 raise UnpicklingError("EXT specifies code <= 0")
1679 raise ValueError("unregistered extension code %d" % code)
1680 obj = self.find_class(*key)
1681 _extension_cache[code] = obj
1682 self.append(obj)
1683
1684 def find_class(self, module, name):
1685 # Subclasses may override this.

Callers 3

load_ext1Method · 0.95
load_ext2Method · 0.95
load_ext4Method · 0.95

Calls 4

find_classMethod · 0.95
UnpicklingErrorClass · 0.85
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected