X Tutup
Skip to content

Commit ae717e0

Browse files
fix issues #240
1 parent b4bef26 commit ae717e0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bpython/inspection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ def getargspec(func, f):
219219
# Check if it's a real bound method or if it's implicitly calling __init__
220220
# (i.e. FooClass(...) and not FooClass.__init__(...) -- the former would
221221
# not take 'self', the latter would:
222-
func_name = getattr(f, '__name__', None)
222+
try:
223+
func_name = getattr(f, '__name__', None)
224+
except:
225+
# if calling foo.__name__ would result in an error
226+
func_name = None
223227

224228
try:
225229
is_bound_method = ((inspect.ismethod(f) and f.im_self is not None)

0 commit comments

Comments
 (0)
X Tutup