Skip to content

Fix crash when using getargspec with xmlrpclib #202

Closed

Description

@ikanobori

Attached diff fix a crash when bpython tries to retrieve the arguments of a function provided by python's xmlrpclib module:

>>> import xmlrpclib
>>> api = xmlrpclib.Server("http://localhost")
>>> api.login

Then I hit '(' and get :

Traceback (most recent call last):                                 
  File "/usr/local/bin/bpython", line 8, in <module>
    load_entry_point('bpython==0.10.1', 'console_scripts', 'bpython')()
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 1756, in 
main
    banner=banner)
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 1658, in 
curses_wrapper
    return func(stdscr, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 1727, in 
main_curses
    clirepl.repl()
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 1015, in 
repl
    inp = self.get_line()
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 600, in g
et_line
    if self.p_key(key) is None:
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 911, in p
_key
    self.addstr(key)
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 290, in a
ddstr
    self.complete()
  File "/usr/local/lib/python2.7/site-packages/bpython/cli.py", line 383, in $
omplete
    self.list_win_visible = repl.Repl.complete(self, tab)
  File "/usr/local/lib/python2.7/site-packages/bpython/repl.py", line 540, in 
complete
    if not self.get_args():
  File "/usr/local/lib/python2.7/site-packages/bpython/repl.py", line 511, in 
get_args
    self.argspec = inspection.getargspec(func, f)
  File "/usr/local/lib/python2.7/site-packages/bpython/inspection.py", line 23
2, in getargspec
    or (func_name == '__init__'))
  File "/usr/local/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/local/lib/python2.7/xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "/usr/local/lib/python2.7/xmlrpclib.py", line 1468, in parse_response
    return u.close()
  File "/usr/local/lib/python2.7/xmlrpclib.py", line 793, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: 'Method "login.__name__.__eq__" is not supported'>

I'm using bpython 0.10.1 with Python 2.7.1 on OpenBSD


Activity

  1. ikanobori commented on Jul 4, 2014

    @ikanobori
    ContributorAuthor

    Fixed in [[https://bitbucket.org/bobf/bpython/changeset/e437bee0b1b2|e437bee0b1b2]].


    Original Comment By: Sebastian Ramacher

  2. ikanobori commented on Jul 4, 2014

    @ikanobori
    ContributorAuthor

    The attached patch fixes the issue but also disables getargspec for almost any other object. That's definitly not what we want. I'll try to come up with a patch that fixes the issue.


    Original Comment By: Sebastian Ramacher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions