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

Method get_extension

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

Source from the content-addressed store, hash-verified

1698 dispatch[EXT4[0]] = load_ext4
1699
1700 def get_extension(self, code):
1701 obj = _extension_cache.get(code, _NoValue)
1702 if obj is not _NoValue:
1703 self.append(obj)
1704 return
1705 key = _inverted_registry.get(code)
1706 if not key:
1707 if code <= 0: # note that 0 is forbidden
1708 # Corrupt or hostile pickle.
1709 raise UnpicklingError("EXT specifies code <= 0")
1710 raise ValueError("unregistered extension code %d" % code)
1711 obj = self.find_class(*key)
1712 _extension_cache[code] = obj
1713 self.append(obj)
1714
1715 def find_class(self, module, name):
1716 # 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