Skip to content

Commit 590507b

Browse files
mikolaj-klikowiczsebastinas
authored andcommitted
Handle AttributeError
Signed-off-by: Mikolaj Klikowicz <mklikowicz@internships.antmicro.com>
1 parent 1db0436 commit 590507b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bpython/inspection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ def __enter__(self) -> None:
104104
if __getattr__ is not None:
105105
try:
106106
setattr(type_, "__getattr__", (lambda *_, **__: None))
107-
except TypeError:
107+
except (TypeError, AttributeError):
108108
__getattr__ = None
109109
__getattribute__ = getattr(type_, "__getattribute__", None)
110110
if __getattribute__ is not None:
111111
try:
112112
setattr(type_, "__getattribute__", object.__getattribute__)
113-
except TypeError:
113+
except (TypeError, AttributeError):
114114
# XXX: This happens for e.g. built-in types
115115
__getattribute__ = None
116116
self._attribs = (__getattribute__, __getattr__)

0 commit comments

Comments
 (0)