Skip to content
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

raising __getattribute__ causes unhandled exception in event loop #351

Closed
linupi opened this issue Mar 31, 2020 · 0 comments · Fixed by #365
Closed

raising __getattribute__ causes unhandled exception in event loop #351

linupi opened this issue Mar 31, 2020 · 0 comments · Fixed by #365

Comments

@linupi
Copy link

linupi commented Mar 31, 2020

working on linux64 with ptpython 3.0.1 on top of python 3.7.7 I see the following difference between ptpython and native python command-line:

ptpython

>>> class Foo(): 
...     def __getattribute__(self,*args): 
...         raise Exception()                                                                                                                             

>>> f=Foo()                                                                                                                                               


Unhandled exception in event loop:
  File "... lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "... lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 653, in read_from_input
    self.key_processor.process_keys()
  File "... lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 274, in process_keys
    self._process_coroutine.send(key_press)
  File "... lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 186, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "... lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 329, in _call_handler
    handler.call(event)
  File "... lib/python3.7/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 101, in call
    self.handler(event)
  File "... lib/python3.7/site-packages/ptpython/key_bindings.py", line 124, in _
    if b.validate():
  File "... lib/python3.7/site-packages/prompt_toolkit/buffer.py", line 1262, in validate
    self.validator.validate(self.document)
  File "... lib/python3.7/site-packages/prompt_toolkit/validation.py", line 175, in validate
    self.validator.validate(document)
  File "... lib/python3.7/site-packages/ptpython/validator.py", line 28, in validate
    flags = self.get_compiler_flags()
  File "... lib/python3.7/site-packages/ptpython/python_input.py", line 362, in get_compiler_flags
    if isinstance(value, __future__._Feature):
  File "<stdin>", line 3, in __getattribute__

Exception 
Press ENTER to continue... 

python cmd

>>> class Foo():
...   def __getattribute__(self,*args):
...     raise Exception()
... 
>>> f=Foo()
>>>

is this the desired/expected behavior of ptpython?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant