Skip to content

Commit 974f26f

Browse files
committed
Cut _safe_has_attribute
1 parent 85805f7 commit 974f26f

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

astroid/raw_building.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,6 @@ def _build_from_function(
316316
object_build_function(node, member, name)
317317

318318

319-
def _safe_has_attribute(obj, member: str) -> bool:
320-
try:
321-
return hasattr(obj, member)
322-
except Exception: # pylint: disable=broad-except
323-
return False
324-
325-
326319
class InspectBuilder:
327320
"""class for building nodes from living object
328321
@@ -418,7 +411,7 @@ def object_build(
418411
# This should be called for Jython, where some builtin
419412
# methods aren't caught by isbuiltin branch.
420413
_build_from_function(node, name, member, self._module)
421-
elif _safe_has_attribute(member, "__all__"):
414+
elif hasattr(member, "__all__"):
422415
module = build_module(name)
423416
_attach_local_node(node, module, name)
424417
# recursion

0 commit comments

Comments
 (0)