X Tutup
Skip to content

curtsies frontend import completion bug #263

@ikanobori

Description

@ikanobori

If the following code is typed very quickly after bpython-curtsies invocation, import completion has not yet finished, and bpython crashes:
$ bpython-curtsies
>>> import os

#!python

tom-mba:~ tomb$ bpython-curtsies
>>> import o
Traceback (most recent call last):
  File "/usr/local/bin/bpython-curtsies", line 9, in <module>
    load_entry_point('bpython==mercurial', 'console_scripts', 'bpython-curtsies')()
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py", line 51, in main
    mainloop(config, locals_, banner, interp, paste)
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py", line 88, in mainloop
    process_event(tc.get_event())
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py", line 67, in process_event
    repl.process_event(e)
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py", line 335, in process_event
    self.update_completion()
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py", line 450, in update_completion
    self.list_win_visible = BpythonRepl.complete(self, tab)
  File "/Users/tomb/Dropbox/code/bpython/bpython/repl.py", line 588, in complete
    matches = importcompletion.complete(self.current_line(), cw)
  File "/Users/tomb/Dropbox/code/bpython/bpython/importcompletion.py", line 77, in complete
    for name in modules:
RuntimeError: Set changed size during iteration
tom-mba:~ tomb$

Import completion should happen in a coroutine instead of a thread, or there should be a lock around the import completion modules list that the import completion code gives up to allow keys to be pressed, or something.


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

      X Tutup