Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions haystack/core/component/sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: Apache-2.0

from typing import Any

from haystack.core.type_utils import _type_name

Expand Down Expand Up @@ -123,16 +122,6 @@ def _component_name(self) -> str:
# __repr__ method and that would lead to infinite recursion since we call Sockets.__repr__ in it.
return object.__repr__(self._component)

def __getattribute__(self, name: Any) -> Any:
try:
sockets = object.__getattribute__(self, "_sockets")
if name in sockets:
return sockets[name]
except AttributeError:
pass

return object.__getattribute__(self, name)

def __repr__(self) -> str:
result = ""
if self._sockets_io_type == InputSocket:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
enhancements:
- |
Removed the ``Sockets.__getattribute__`` override. It looked up a ``_sockets``
attribute that no instance has, so on every attribute access it raised and
caught ``AttributeError`` and never returned a socket; socket access has always
gone through the copies ``__init__`` and ``__setitem__`` put in ``__dict__``.
Without the override, accessing a socket attribute such as
``component.__haystack_input__.query`` is about 14x faster.