Skip to content

Commit 669a788

Browse files
author
Sebastian Ramacher
committed
Catch exceptions in getargspec (Closes: #202)
If f is a remoted method from a xmlrpclib.Server instance func_name == '__init__' will throw an exception.
1 parent aa857f7 commit 669a788

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bpython/inspection.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,14 @@ def getargspec(func, f):
228228
# not take 'self', the latter would:
229229
func_name = getattr(f, '__name__', None)
230230

231-
is_bound_method = ((inspect.ismethod(f) and f.im_self is not None)
231+
try:
232+
is_bound_method = ((inspect.ismethod(f) and f.im_self is not None)
232233
or (func_name == '__init__' and not
233234
func.endswith('.__init__')))
235+
except:
236+
# if f is a method from a xmlrpclib.Server instance, func_name ==
237+
# '__init__' throws xmlrpclib.Fault (see #202)
238+
return None
234239
try:
235240
if py3:
236241
argspec = inspect.getfullargspec(f)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy