(self, module, name)
| 1682 | self.append(obj) |
| 1683 | |
| 1684 | def find_class(self, module, name): |
| 1685 | # Subclasses may override this. |
| 1686 | sys.audit('pickle.find_class', module, name) |
| 1687 | if self.proto < 3 and self.fix_imports: |
| 1688 | if (module, name) in _compat_pickle.NAME_MAPPING: |
| 1689 | module, name = _compat_pickle.NAME_MAPPING[(module, name)] |
| 1690 | elif module in _compat_pickle.IMPORT_MAPPING: |
| 1691 | module = _compat_pickle.IMPORT_MAPPING[module] |
| 1692 | __import__(module, level=0) |
| 1693 | if self.proto >= 4 and '.' in name: |
| 1694 | dotted_path = name.split('.') |
| 1695 | try: |
| 1696 | return _getattribute(sys.modules[module], dotted_path) |
| 1697 | except AttributeError: |
| 1698 | raise AttributeError( |
| 1699 | f"Can't resolve path {name!r} on module {module!r}") |
| 1700 | else: |
| 1701 | return getattr(sys.modules[module], name) |
| 1702 | |
| 1703 | def load_reduce(self): |
| 1704 | stack = self.stack |
no test coverage detected