@@ -241,9 +241,12 @@ def verify_typeinfo(
241
241
to_check .update (m for m in cast (Any , vars )(runtime ) if not m .startswith ("_" ))
242
242
243
243
for entry in sorted (to_check ):
244
+ mangled_entry = entry
245
+ if entry .startswith ("__" ) and not entry .endswith ("__" ):
246
+ mangled_entry = "_{}{}" .format (stub .name , entry )
244
247
yield from verify (
245
248
next ((t .names [entry ].node for t in stub .mro if entry in t .names ), MISSING ),
246
- getattr (runtime , entry , MISSING ),
249
+ getattr (runtime , mangled_entry , MISSING ),
247
250
object_path + [entry ],
248
251
)
249
252
@@ -267,7 +270,13 @@ def _verify_static_class_methods(
267
270
# Look the object up statically, to avoid binding by the descriptor protocol
268
271
static_runtime = importlib .import_module (object_path [0 ])
269
272
for entry in object_path [1 :]:
270
- static_runtime = inspect .getattr_static (static_runtime , entry )
273
+ try :
274
+ static_runtime = inspect .getattr_static (static_runtime , entry )
275
+ except AttributeError :
276
+ # This can happen with mangled names, ignore for now.
277
+ # TODO: pass more information about ancestors of nodes/objects to verify, so we don't
278
+ # have to do this hacky lookup. Would be useful in a couple other places too.
279
+ return
271
280
272
281
if isinstance (static_runtime , classmethod ) and not stub .is_class :
273
282
yield "runtime is a classmethod but stub is not"
0 commit comments