Skip to content

reproducible trackeback with completion #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ikanobori opened this issue Jul 4, 2014 · 5 comments
Closed

reproducible trackeback with completion #42

ikanobori opened this issue Jul 4, 2014 · 5 comments
Labels

Comments

@ikanobori
Copy link
Contributor

Steps to reproduce it:

  1. Make sure lxml is installed

  2. Open bpython (mine is changeset 238:fbe8addaf66f)

  3. Type this:

    from lxml.etree import XMLParser
    help(XMLP

  4. Now type the tab key for completing, bpython adds "arser("

  5. Type tab again and bpython crashes with the following traceback:

    Traceback (most recent call last):
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 2161, in main
    o = curses.wrapper(main_curses, exec_args, options.interactive)
    File "/usr/lib/python2.6/curses/wrapper.py", line 44, in wrapper
    return func(stdscr, _args, *_kwds)
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 2103, in main_curses
    repl.repl()
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 1199, in repl
    inp = self.get_line()
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 1755, in get_line
    if self.p_key() is None:
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 1535, in p_key
    return self.tab()
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 1564, in tab
    self.complete(tab=True)
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 668, in complete
    self.list_win_visible = self._complete(tab)
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 743, in _complete
    self.show_list(self.matches, self.argspec)
    File "/usr/lib/python2.6/site-packages/bpython/cli.py", line 834, in show_list
    self.list_win.mvwin(y + 1, 0)
    error: mvwin() returned ERR


@ikanobori
Copy link
Contributor Author

Okay, I put in a horrible catch-all in this, so if there are any curses errors it'll just go "oh well" and try to display the list window anyway. This is a terrible "fix", but it at least stops bpython from crashing. This will of course all go away when I finish writing my curses lib. :)


Original Comment By:

@ikanobori
Copy link
Contributor Author

I can reproduce, however it fails as soon as I do help(XML [tab] and then type the ( myself.

{{{
#!txt

Traceback (most recent call last):
File "cli.py", line 2166, in main
o = curses.wrapper(main_curses, exec_args, options.interactive)
File "/usr/lib/python2.5/curses/wrapper.py", line 44, in wrapper
return func(stdscr, _args, *_kwds)
File "cli.py", line 2108, in main_curses
repl.repl()
File "cli.py", line 1204, in repl
inp = self.get_line()
File "cli.py", line 1760, in get_line
if self.p_key() is None:
File "cli.py", line 1544, in p_key
self.addstr(self.c)
File "cli.py", line 1619, in addstr
self.complete()
File "cli.py", line 668, in complete
self.list_win_visible = self._complete(tab)
File "cli.py", line 743, in _complete
self.show_list(self.matches, self.argspec)
File "cli.py", line 764, in show_list
height_offset = self.mkargspec(topline, down) + 1
File "cli.py", line 954, in mkargspec
self.list_win.addstr(', ', get_colpair("punctuation"))
error: addstr() returned ERR

}}}


Original Comment By: Simon de Vlieger

@ikanobori
Copy link
Contributor Author

Right, I should have said lxml version is 2.2.

I've updated to changeset 239 but I still can reproduce the crash. I've tried your method to execute from the source directory.

By the way, I've noticed "help" has nothing to do with it. Just expanding behind "XMLParser(" is enough.

I'll drop in the channel tomorrow.


Original Comment By: Anonymous

@ikanobori
Copy link
Contributor Author

Looks like I was using an old version of lxml - with the new version I could reproduce the problem.

I've fixed it in the tip now - please pull/update and see if you still experience any problems. I'm going to be gutting all of the code that creates these problems soon-ish so the whole thing should look a whole lot better then.


Original Comment By:

@ikanobori
Copy link
Contributor Author

Hi, thanks for reporting the issue but, unfortunately, I'm unable to reproduce it.

Are you definitely running the version you think you're running ? setuptools can make things confusing in terms of this - try running it as
{{{
cd bpython
PYTHONPATH=. python bpython/cli.py
}}}

One thing that makes me think you're not using the tip is because, due to some changes elsewhere, the parenthesis is not added onto the end of callables on completion anymore (and the parenthesis is not shown in the completion list).

Would it be possible for you to come to our IRC channel so we can try to get to the bottom of this ? #bpython on irc.freenode.net

Thanks :)


Original Comment By:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant