Skip to content

Tab completion for dict key causes crash #917

Closed
@arian-deimling

Description

@arian-deimling

This issue is not reproducible with several different dicts that I've tried, but it can be reproduced with the dict below.

my_dict = {
'Circle': {'Ellipse',
           'Shape',
           'ShapeDriver'},

'Ellipse': {'Shape'},

'Rectangle': {'Shape'},

'Shape': {'Circle'},

'ShapeDriver': {'Circle',
                'Ellipse',
                'Shape'},

'Square': {'Rectangle'}
}

Steps to recreate:

  1. create new dict
  2. type my_dict[
  3. press key to use tab-completion
  4. crash
~ % bpython
bpython version 0.21 on top of Python 3.8.2 /Library/Developer/CommandLineTools/usr/bin/python3
>>> my_dict = {
... 'a/Circle': {'Ellipse',
...            'Shape',
...            'ShapeDriver'},
... 
... 'a/Ellipse': {'Shape'},
... 
... 'a/Rectangle': {'Shape'},
... 
... 'a/Shape': {'Circle'},
... 
... 'a/ShapeDriver': {'Circle',
...                 'Ellipse',
...                 'Shape'},
... 
... 'a/Square': {'Rectangle'}
... }
>>> my_dict['b/banana']
Traceback (most recent call last):
  File "/Users/arian/Library/Python/3.8/bin/bpython", line 8, in <module>
    sys.exit(main())
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsies.py", line 201, in main
    exit_value = repl.mainloop(True, paste)
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsies.py", line 121, in mainloop
    self.process_event_and_paint(e)
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsies.py", line 85, in process_event_and_paint
    self.process_event(e)
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsiesfrontend/repl.py", line 615, in process_event
    return self.process_key_event(e)
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsiesfrontend/repl.py", line 757, in process_key_event
    self.on_tab()
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsiesfrontend/repl.py", line 891, in on_tab
    cursor_and_line = self.matches_iter.substitute_cseq()
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/repl.py", line 297, in substitute_cseq
    self.update(
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/repl.py", line 318, in update
    self.start, self.end, self.current_word = self.completer.locate(
TypeError: cannot unpack non-iterable NoneType object

Image below so you can see the colors as well:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      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