Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Uncaught exception byrepl.complete #776

Closed
@BenWiederhake

Description

@BenWiederhake

When generating completions, bpython has to interact with the given objects. These objects might be the product of active development, so a bug in, for example,__getattribute__ of the user code happens sometimes. bpython should stomach such errors.

Minimal reproducing example:

$ bpython3bpython version 0.17.1 on top of Python 3.7.3 /usr/bin/python3>>> class BadClass:...     def __getattribute__(self, name):...         assert False, "Let's say there is a bug here."... >>> x = BadClass()>>> x(Traceback (most recent call last):  File "/usr/bin/bpython3", line 11, in <module>    load_entry_point('bpython==0.17.1', 'console_scripts', 'bpython')()  File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 191, in main    exit_value = repl.mainloop(True, paste)  File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 126, in mainloop    self.process_event_and_paint(e)  File "/usr/lib/python3/dist-packages/bpython/curtsies.py", line 90, in process_event_and_paint    self.process_event(e)  File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py", line 603, in process_event    return self.process_key_event(e)  File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py", line 757, in process_key_event    self.add_normal_character(e)  File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py", line 1001, in add_normal_character    self.cursor_offset += 1  File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py", line 1594, in _set_cursor_offset    self.update_completion()  File "/usr/lib/python3/dist-packages/bpython/curtsiesfrontend/repl.py", line 1032, in update_completion    self.list_win_visible = self.complete(tab)  File "/usr/lib/python3/dist-packages/bpython/repl.py", line 724, in complete    self.set_docstring()  File "/usr/lib/python3/dist-packages/bpython/repl.py", line 688, in set_docstring    if not self.get_args():  File "/usr/lib/python3/dist-packages/bpython/repl.py", line 635, in get_args    if inspect.isclass(f):  File "/usr/lib/python3.7/inspect.py", line 78, in isclass    return isinstance(object, type)  File "<bpython-input-5>", line 3, in __getattribute__AssertionError: Let's say there is a bug here.[$? = 1]

In the above session, I typed the(, but it did not appear on screen. (Boo me, I edited that part.)

I see two ways to fix this: Either wrap the code incomplete in atry … finally, or wrap all the places where user code gets called. (This might be hard to find.)

None of the other issues seem to be related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp