Skip to content

Crash on dictionary completion of numpy array #455

@thomasballinger

Description

@thomasballinger
(bpython)tom-mba:bpython tomb$ bpython
bpython version 0.13-416 on top of Python 2.7.5 /Users/tomb/.virtualenvs/bpython/bin/python2.7
>>> import numpy
>>> a = numpy.zeros((2, 3))
>>> a
array([[ 0.,  0.,  0.],
       [ 0.,  0.,  0.]])
>>> a
Traceback (most recent call last):
  File "/Users/tomb/.virtualenvs/bpython/bin/bpython", line 9, in <module>
    load_entry_point('bpython==0.13-416', 'console_scripts', 'bpython')()
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py", line 69, in main
    mainloop(config, locals_, banner, interp, paste, interactive=(not exec_args))
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py", line 151, in mainloop
    process_event(e)
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py", line 114, in process_event
    repl.process_event(e)
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py", line 433, in process_event
    return self.process_key_event(e)
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py", line 562, in process_key_event
    self.add_normal_character(e)
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py", line 767, in add_normal_character
    self.cursor_offset += 1
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py", line 1253, in _set_cursor_offset
    self.update_completion()
  File "/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py", line 796, in update_completion
    self.list_win_visible = BpythonRepl.complete(self, tab)
  File "/Users/tomb/Dropbox/code/bpython/bpython/repl.py", line 537, in complete
    complete_magic_methods=self.config.complete_magic_methods)
  File "/Users/tomb/Dropbox/code/bpython/bpython/autocomplete.py", line 348, in get_completer_bpython
    **kwargs)
  File "/Users/tomb/Dropbox/code/bpython/bpython/autocomplete.py", line 330, in get_completer
    matches = completer.matches(cursor_offset, line, **kwargs)
  File "/Users/tomb/Dropbox/code/bpython/bpython/autocomplete.py", line 222, in matches
    if obj and isinstance(obj, type({})) and obj.keys():
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions