Skip to content

Bpython exits if parenthese is typed after a property raising exception #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ikanobori opened this issue Jul 4, 2014 · 5 comments
Closed
Labels

Comments

@ikanobori
Copy link
Contributor

The following session results in bpython==0.12 exiting and dumping the exception raised by the user code.

#!python

>>> class A:
...   @property
...   def a(self): return 1/0
... 
>>> a=A()
>>> a.a(

@ikanobori
Copy link
Contributor Author

PR for this at https://bitbucket.org/bobf/bpython/pull-request/55/fix-for-281/diff


Original Comment By:

@ikanobori
Copy link
Contributor Author

Looking into this tomorrow, might be in a bugfix release soon. Thanks for the reports! @myint , thanks for raising #293 regarding the other comment.


Original Comment By:

@ikanobori
Copy link
Contributor Author

@mixmastamyk's error seems a bit different. Based on the trace, it looks specific to curtsies. The problem Anonymous reported is an error in repl.py, which is general to both bpython and bpython-curtsies.


Original Comment By: Steven Myint

@ikanobori
Copy link
Contributor Author

Maybe related, on 0.13, this crash upon the left paren keystroke:

> bpython-curtsies
>>> import sys
>>> sys.getdefaultencoding
Traceback (most recent call last):
  File "/usr/local/bin/bpython-curtsies", line 9, in <module>
    load_entry_point('bpython==0.13', 'console_scripts', 'bpython-curtsies')()
  File "/usr/local/lib/python2.7/dist-packages/bpython/curtsies.py", line 52, in main
    mainloop(config, locals_, banner, interp, paste)
  File "/usr/local/lib/python2.7/dist-packages/bpython/curtsies.py", line 84, in mainloop
    process_event(term.get_annotated_event(idle=find_iterator))
  File "/usr/local/lib/python2.7/dist-packages/bpython/curtsies.py", line 75, in process_event
    array, cursor_pos = repl.paint()
  File "/usr/local/lib/python2.7/dist-packages/bpython/curtsiesfrontend/repl.py", line 794, in paint
    infobox = paint.paint_infobox(info_max_rows, int(width * self.config.cli_suggestion_width), self.matches, self.args)
  File "/usr/local/lib/python2.7/dist-packages/bpython/curtsiesfrontend/replpainter.py", line 156, in paint_infobox
    (matches_lines(rows, width, matches, match, config) if matches else []) +
  File "/usr/local/lib/python2.7/dist-packages/bpython/curtsiesfrontend/replpainter.py", line 90, in formatted_argspec
    s = func_color(func) + arg_color(': (')
  File "/usr/local/lib/python2.7/dist-packages/curtsies/fmtstr.py", line 509, in fmtstr
    atts = parse_args(args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/curtsies/fmtstr.py", line 494, in parse_args
    raise ValueError("Bad fg value: %s", kwargs['fg'])
ValueError: ('Bad fg value: %s', 'default')

Original Comment By: Gringo Suave

@ikanobori
Copy link
Contributor Author

$ bpython-curtsies
>>> class A:
...     @property
...     def a(self): return 1 / 0
...
...
>>> a = A()
>>> a.a
Traceback (most recent call last):
  File "/Users/myint/Library/Python/3.4/bin/bpython-curtsies", line 9, in <module>
    load_entry_point('bpython==0.13', 'console_scripts', 'bpython-curtsies')()
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/curtsies.py", line 52, in main
    mainloop(config, locals_, banner, interp, paste)
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/curtsies.py", line 84, in mainloop
    process_event(term.get_annotated_event(idle=find_iterator))
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/curtsies.py", line 68, in process_event
    repl.process_event(e)
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/curtsiesfrontend/repl.py", line 360, in prot
    self.update_completion()
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/curtsiesfrontend/repl.py", line 480, in updn
    self.list_win_visible = BpythonRepl.complete(self, tab)
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/repl.py", line 560, in complete
    if not self.get_args():
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/repl.py", line 519, in get_args
    f = self.get_object(func)
  File "/Users/myint/Library/Python/3.4/lib/python/site-packages/bpython/repl.py", line 465, in get_object
    obj = getattr(obj, attributes.pop(0))
  File "<input>", line 3, in a
ZeroDivisionError: division by zero

Original Comment By: Steven Myint

thomasballinger added a commit that referenced this issue Jul 5, 2014
thomasballinger added a commit that referenced this issue Jul 6, 2014
thomasballinger added a commit that referenced this issue Jul 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants