Skip to content

Commit

Permalink
Merge pull request #90 from Shoobx/fix-metaclass-conflict
Browse files Browse the repository at this point in the history
Fix metaclass conflict
  • Loading branch information
kedder committed Feb 10, 2023
2 parents 88308ac + a9954b7 commit 9fc2bd7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 75 deletions.
9 changes: 2 additions & 7 deletions src/mypy_zope/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,8 @@ def _apply_interface(self, impl: TypeInfo, iface: TypeInfo) -> None:
# there is a decorator for the class that will create a "type promotion",
# but ensure this only gets applied a single time per interface.
promote = Instance(iface, [])
if not any(promote in ti._promote for ti in impl.mro):
faketi = TypeInfo(SymbolTable(), iface.defn, iface.module_name)
faketi._promote = [promote]
faketi.metaclass_type = iface.metaclass_type
# Insert the TypeInfo before the builtins.object that's at the end.
assert impl.mro[-1].fullname == 'builtins.object'
impl.mro.insert(len(impl.mro) - 1, faketi)
if promote not in impl._promote:
impl._promote.append(promote)


def plugin(version: str) -> PyType[Plugin]:
Expand Down
68 changes: 0 additions & 68 deletions tests/test_mro_calculation.py

This file was deleted.

0 comments on commit 9fc2bd7

Please sign in to comment.