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

Dealing with exceptions (eg KeyboardInterrupt) in python functions called via C++ #9

Open
joschu opened this issue Aug 28, 2015 · 0 comments

Comments

@joschu
Copy link
Owner

joschu commented Aug 28, 2015

Moving this over from the bitbucket tracker...

Suppose you run the following script CGT_FLAGS=backend=native python examples/demo_mnist.py
and then hit control-C during execution. Chances are, you'll see something like the following
^CException KeyboardInterrupt in 'cycgt._pyfunc_byval' ignored ^C[1] 7414 segmentation fault CGT_FLAGS=backend=native python demo_mnist.py
Some of the operations are still only implemented in python. Sometimes KeyBoardInterrupts will get caught by python and then ignored by cython, causing undesirable/unpredictable behavior.
At the very least, we should abort() from cython. Better yet, we'd set some error flag, which would get caught by the C++ interpreter to stop execution, and then finally we'd raise a Python exception.

Anyway, @hojonathanho has a fix implemented that involves introducing some python exception machinery into execution.{cpp/h}. We agree that including this stuff is a bit undesirable, so we're holding off on merging for now. But I'll leave this issue as a placeholder, in case we decide to deal with it later.

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

No branches or pull requests

1 participant