Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Syntax error in autocompletion crashes bpython #347

Copy link
Copy link
@mlauter

Description

@mlauter
Issue body actions

Using the latest bpython-curtsies

What I started with was this line:

re.sub(r'(^\w+Error|^error)',r"blue('\1')",list[-1])

Then I realized, wait, I'd like to set line[-1] equal to this expression I wrote out, so I ctrl-A ed back to the front, and started typing line[-1... in front of the expression I had written. Then bpython exploded:

 list[-re.sub(r'(^\w+Error|^error)',r"blue('\1')",list[-1])
Traceback (most recent call last):
  File "/Users/Miriam/.virtualenvs/bpython-dev/bin/bpython-curtsies", line 9, in <module>
    load_entry_point('bpython==mercurial', 'console_scripts', 'bpython-curtsies')()
  File "/Users/Miriam/HSchool/bpython/bpython/curtsies.py", line 66, in main
    mainloop(config, locals_, banner, interp, paste, interactive=(not exec_args))
  File "/Users/Miriam/HSchool/bpython/bpython/curtsies.py", line 132, in mainloop
    process_event(e)
  File "/Users/Miriam/HSchool/bpython/bpython/curtsies.py", line 115, in process_event
    repl.process_event(e)
  File "/Users/Miriam/HSchool/bpython/bpython/curtsiesfrontend/repl.py", line 532, in process_event
    self.update_completion()
  File "/Users/Miriam/HSchool/bpython/bpython/curtsiesfrontend/repl.py", line 643, in update_completion
    self.list_win_visible = BpythonRepl.complete(self, tab)
  File "/Users/Miriam/HSchool/bpython/bpython/repl.py", line 633, in complete
    self.config.complete_magic_methods)
  File "/Users/Miriam/HSchool/bpython/bpython/autocomplete.py", line 84, in get_completer
    matches = AttrCompletion.matches(cursor_offset, current_line, **kwargs)
  File "/Users/Miriam/HSchool/bpython/bpython/autocomplete.py", line 186, in matches
    attr_matches(methodtext, locals_, mode)]
  File "/Users/Miriam/HSchool/bpython/bpython/autocomplete.py", line 362, in attr_matches
    obj = safe_eval(expr, namespace)
  File "/Users/Miriam/HSchool/bpython/bpython/autocomplete.py", line 343, in safe_eval
    obj = eval(expr, namespace)
  File "<string>", line 1
    1re
      ^
SyntaxError: unexpected EOF while parsing

Just to be clear, I hadn't hit enter yet or anything, I was just in the process of typing.

All you really need to do to reproduce the error is have something like re.search() and then go back to the beginning of the line and type 1

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.