@@ -482,34 +482,33 @@ def is_for_this_target(ftcls):
482482
483483 return current_target .inherits_from (ft_target )
484484
485- def is_external_type ( typ ):
486- """Check if a type is from outside numba.* namespace."""
485+ def is_external ( obj ):
486+ """Check if obj is from outside numba.* namespace."""
487487 try :
488- return not typ .__module__ .startswith ("numba." )
488+ return not obj .__module__ .startswith ("numba." )
489489 except AttributeError :
490490 return True
491491
492- # Skip functions entirely when external_defs_only=True
493- if not external_defs_only :
494- for ftcls in loader .new_registrations ("functions" ):
495- if not is_for_this_target (ftcls ):
496- continue
497- self .insert_function (ftcls (self ))
492+ for ftcls in loader .new_registrations ("functions" ):
493+ if not is_for_this_target (ftcls ):
494+ continue
495+ # If external_defs_only, install templates only from external modules
496+ if external_defs_only and not is_external (ftcls ):
497+ continue
498+ self .insert_function (ftcls (self ))
498499 for ftcls in loader .new_registrations ("attributes" ):
499500 if not is_for_this_target (ftcls ):
500501 continue
501502 # If external_defs_only, check if the type being registered is external
502503 if external_defs_only :
503504 key = getattr (ftcls , "key" , None )
504- if key is not None and not is_external_type (key ):
505+ if key is not None and not is_external (key ):
505506 continue
506507 self .insert_attributes (ftcls (self ))
507508 for gv , gty in loader .new_registrations ("globals" ):
508509 # If external_defs_only, check the global type's module
509510 if external_defs_only :
510- if hasattr (gty , "__module__" ) and gty .__module__ .startswith (
511- "numba."
512- ):
511+ if hasattr (gty , "__module__" ) and is_external (gty ):
513512 continue
514513 existing = self ._lookup_global (gv )
515514 if existing is None :
0 commit comments