File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -463,12 +463,11 @@ def _resolve_import_module(obj: t.Any, name: str) -> str:
463463 module_name = getattr (obj , "__module__" , None ) or ""
464464 parts = module_name .split ("." )
465465
466- # Walk from the immediate parent up to (but not including) the top-level
467- # package, stopping at the first ancestor that also exports the object.
468- # We stop before the top-level package to avoid over-normalizing
469- # (e.g. ``sqlglot`` re-exports everything, but callers expect the more
470- # specific ``sqlglot.expressions`` when that is where the object lives).
471- for i in range (len (parts ) - 1 , 1 , - 1 ):
466+ # Walk from the shallowest ancestor (excluding the top-level package) up to
467+ # the immediate parent, returning the shallowest one that re-exports the object.
468+ # We skip the top-level package to avoid over-normalizing (e.g. ``sqlglot``
469+ # re-exports everything, but callers expect ``sqlglot.expressions``).
470+ for i in range (2 , len (parts )):
472471 parent = "." .join (parts [:i ])
473472 try :
474473 parent_module = sys .modules .get (parent ) or importlib .import_module (parent )
You can’t perform that action at this time.
0 commit comments