You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
REPL errors out on numpy.array initialization expression #879
As the user starts typing a numpy.array initialization expression, the REPL produces a TypeError and exits.
Consider the following example, where the error is produced when the user tries to type np.array([1, 2:
(env) /Users/georgepf>bpython
bpython version 0.20.1 on top of Python 3.9.1 /Users/georgepf/env/bin/python3
>>> import numpy as np
>>> np.array([1,
Traceback (most recent call last):
File "/Users/georgepf/env/bin/bpython", line 8, in <module>
sys.exit(main())
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsies.py", line 221, in main
exit_value = repl.mainloop(True, paste)
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsies.py", line 133, in mainloop
self.process_event_and_paint(e)
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsies.py", line 97, in process_event_and_paint
self.process_event(e)
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsiesfrontend/repl.py", line 658, in process_event
return self.process_key_event(e)
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsiesfrontend/repl.py", line 825, in process_key_event
self.add_normal_character(e)
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsiesfrontend/repl.py", line 1111, in add_normal_character
self.cursor_offset += 1
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsiesfrontend/repl.py", line 1821, in _set_cursor_offset
self.update_completion()
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/curtsiesfrontend/repl.py", line 1143, in update_completion
self.list_win_visible = self.complete(tab)
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/repl.py", line 770, in complete
self.matches_iter.update(
File "/Users/georgepf/env/lib/python3.9/site-packages/bpython/repl.py", line 356, in update
self.start, self.end, self.current_word = self.completer.locate(
TypeError: cannot unpack non-iterable NoneType object
(env) /Users/georgepf>
This was on an M1 MacBook Pro running macOS Big Sur 11.1, python 3.9.1 and bpython are running natively on Apple silicon, numpy is 1.21.0 compiled locally for M1.
Unfortunately I'm unable to reproduce the issue with both bpython 0.20.1 and master and numpy 1.19.5. So could you gives us some more info on the installed packages, e.g. versions of six, curtsies, jedi and so on.
Does that happen within in a virtual env? Is numpy installed in that venv? Is bpython installed in that venv and run from within the venv? (Sorry for all the questions, but I'm still unable to reproduce the issue; even with the same Ubuntu version).
Activity
sebastinas commentedon Jan 21, 2021
Unfortunately I'm unable to reproduce the issue with both bpython 0.20.1 and master and numpy 1.19.5. So could you gives us some more info on the installed packages, e.g. versions of six, curtsies, jedi and so on.
erikv85 commentedon Mar 8, 2021
Have the same issue, bpython version 0.18 on top of Python 3.8.5, numpy version 1.20.1.
sebastinas commentedon Mar 9, 2021
@erikv85 Can you try with a more recent version of bpython? Do you have jedi installed?
erikv85 commentedon Mar 9, 2021
@sebastinas Upgraded to version 0.21, problem remains.
jedi: I didn''t have jedi installed (i.e., doesn't show in "pip3 list"), installed 0.18.0, problem remains.
six: 1.14.0
curtsies: 0.3.5
sebastinas commentedon Mar 9, 2021
@erikv85 Also on macOS?
erikv85 commentedon Mar 9, 2021
@sebastinas Ubuntu 20.04.2, uname -r -> 5.8.0-44-generic.
sebastinas commentedon Mar 9, 2021
Does that happen within in a virtual env? Is numpy installed in that venv? Is bpython installed in that venv and run from within the venv? (Sorry for all the questions, but I'm still unable to reproduce the issue; even with the same Ubuntu version).
erikv85 commentedon Mar 9, 2021
I'm not very familiar with virtualenv, so I probably didn't install bpython that way.
Re-created it in a Docker image. Something like this:
Finally enter the image (container? ...)
docker exec -u me -it todaybpy bashand try commands as in OP, which will crash.
sebastinas commentedon Mar 10, 2021
Thanks @erikv85, I was now able to reproduce the issue.
Iterate over all completers until the first one with succeeding locat…