Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3c35a8

Browse files
committed
[fix] do not call signature(obj) for non-callables. signature, will check and raise a exception where the message will contain obj.__repr__ and that can be very expensive on certain objects.
1 parent 5d64897 commit e3c35a8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

IPython/core/oinspect.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ def _getdef(self,obj,oname='') -> Union[str,None]:
416416
417417
If any exception is generated, None is returned instead and the
418418
exception is suppressed."""
419+
if not callable(obj):
420+
return None
419421
try:
420422
return _render_signature(signature(obj), oname)
421423
except:

0 commit comments

Comments
 (0)