Skip to content

Commit ce99f81

Browse files
committed
fix: let getattr raise AttributeError directly
1 parent ec59ea1 commit ce99f81

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pandas/io/clipboard/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,8 @@ def _import_module(modules: list[tuple[str, str | None]]):
158158

159159
if attribute_name is None:
160160
return module
161-
elif hasattr(module, attribute_name):
162-
return getattr(module, attribute_name)
163-
else:
164-
raise AttributeError(
165-
f"Module {module_name} doesn't have attribute {attribute_name}."
166-
)
161+
return getattr(module, attribute_name)
162+
167163
except ImportError:
168164
continue
169165

0 commit comments

Comments
 (0)