Skip to content

Commit 32d68a2

Browse files
committed
Fix error introduced in refactor
1 parent 50b45ce commit 32d68a2

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

mypyc/genops.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,20 +1215,17 @@ def handle_ext_method(self, cdef: ClassDef, fdef: FuncDef) -> None:
12151215

12161216
# If this overrides a parent class method with a different type, we need
12171217
# to generate a glue method to mediate between them.
1218-
for cls in class_ir.mro[1:]:
1219-
if (name in cls.method_decls and name != '__init__'
1218+
for base in class_ir.mro[1:]:
1219+
if (name in base.method_decls and name != '__init__'
12201220
and not is_same_method_signature(class_ir.method_decls[name].sig,
1221-
cls.method_decls[name].sig)):
1222-
1223-
if cls is class_ir and not cls.allow_interpreted_children:
1224-
continue
1221+
base.method_decls[name].sig)):
12251222

12261223
# TODO: Support contravariant subtyping in the input argument for
12271224
# property setters. Need to make a special glue method for handling this,
12281225
# similar to gen_glue_property.
12291226

1230-
f = self.gen_glue(cls.method_decls[name].sig, func_ir, class_ir, cls, fdef)
1231-
class_ir.glue_methods[(cls, name)] = f
1227+
f = self.gen_glue(base.method_decls[name].sig, func_ir, class_ir, base, fdef)
1228+
class_ir.glue_methods[(base, name)] = f
12321229
self.functions.append(f)
12331230

12341231
# If the class allows interpreted children, create glue
@@ -1775,13 +1772,9 @@ def gen_glue(self, sig: FuncSignature, target: FuncIR,
17751772
do_py_ops: bool = False
17761773
) -> FuncIR:
17771774
if fdef.is_property:
1778-
return self.gen_glue_property(
1779-
cls.method_decls[fdef.name].sig, target, cls, base, fdef.line, do_py_ops
1780-
)
1775+
return self.gen_glue_property(sig, target, cls, base, fdef.line, do_py_ops)
17811776
else:
1782-
return self.gen_glue_method(
1783-
cls.method_decls[fdef.name].sig, target, cls, base, fdef.line, do_py_ops
1784-
)
1777+
return self.gen_glue_method(sig, target, cls, base, fdef.line, do_py_ops)
17851778

17861779
def gen_glue_method(self, sig: FuncSignature, target: FuncIR,
17871780
cls: ClassIR, base: ClassIR, line: int,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy