(*weakref_mro)
| 1716 | |
| 1717 | @functools.lru_cache() |
| 1718 | def _shadowed_dict_from_weakref_mro_tuple(*weakref_mro): |
| 1719 | for weakref_entry in weakref_mro: |
| 1720 | # Normally we'd have to check whether the result of weakref_entry() |
| 1721 | # is None here, in case the object the weakref is pointing to has died. |
| 1722 | # In this specific case, however, we know that the only caller of this |
| 1723 | # function is `_shadowed_dict()`, and that therefore this weakref is |
| 1724 | # guaranteed to point to an object that is still alive. |
| 1725 | entry = weakref_entry() |
| 1726 | dunder_dict = _get_dunder_dict_of_class(entry) |
| 1727 | if '__dict__' in dunder_dict: |
| 1728 | class_dict = dunder_dict['__dict__'] |
| 1729 | if not (type(class_dict) is types.GetSetDescriptorType and |
| 1730 | class_dict.__name__ == "__dict__" and |
| 1731 | (class_dict.__objclass__ is object or |
| 1732 | class_dict.__objclass__ is entry)): |
| 1733 | return class_dict |
| 1734 | return _sentinel |
| 1735 | |
| 1736 | |
| 1737 | def _shadowed_dict(klass): |
no outgoing calls
no test coverage detected
searching dependent graphs…