Skip to content

Commit a78e95b

Browse files
committed
refactor(pane,session,window): Use object.__getattribute__
See also: - In order to avoid infinite recursion in this method, its implementation should always call the base class method with the same name to access any attributes it needs, for example, object.__getattribute__(self, name) https://docs.python.org/2.7/reference/datamodel.html#object.__getattribute__
1 parent c9c0e60 commit a78e95b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

libtmux/pane.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def refresh(self):
131131
@property
132132
def _info(self):
133133

134-
attrs = {"pane_id": self._pane_id}
134+
attrs = {"pane_id": object.__getattribute__(self, "_pane_id")}
135135

136136
# from https://github.com/serkanyersen/underscore.py
137137
def by(val) -> bool:

libtmux/session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self, server=None, **kwargs):
6363
@property
6464
def _info(self):
6565

66-
attrs = {"session_id": str(self._session_id)}
66+
attrs = {"session_id": object.__getattribute__(self, "_session_id")}
6767

6868
def by(val) -> bool:
6969
for key in attrs.keys():

libtmux/window.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __repr__(self):
7171
@property
7272
def _info(self, *args):
7373

74-
attrs = {"window_id": self._window_id}
74+
attrs = {"window_id": object.__getattribute__(self, "_window_id")}
7575

7676
# from https://github.com/serkanyersen/underscore.py
7777
def by(val) -> bool:

0 commit comments

Comments
 (0)