[C++-sig] how do i interrupt a C++ extension?
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Wed Feb 3 22:42:21 CET 2010
It would be a nice feature to have, but in 8+ years working with Boost.Python I never truly needed it.
I figure if your extension runs a long time it must have some layers of loops. If you can modify the
extension code, I'd reorganize it to move the outer loop into Python. If the extension is a function,
I'd turn it into a class like this:
calc = calculation()
If you figure out how to make Ctrl-C work portably (!), post it here!
----- Original Message ----
From: Amos Anderson <nitroamos at gmail.com>
To: Development of Python/C++ integration <cplusplus-sig at python.org>
Sent: Wed, February 3, 2010 12:24:13 PM
Subject: [C++-sig] how do i interrupt a C++ extension?
I've got a python script with C++ extensions. Some of my extensions
take a long time to complete, and I don't want to wait for them to
finish when I'm debugging stuff. However, when I do Ctrl-C in my
terminal, it's completely ignored. So it looks like python is trapping
the signal, but apparently can't do anything with it until the
extension returns control to the python script. I guess ideally,
Ctrl-C would kill the extension and return control to python,
generating an exception, but I'd also be ok if Ctrl-C killed the
python script too.
I've been googling around, but can't figure out how this seemingly
simple (and desired) task is accomplished. Anybody know how to do it?
Right now, the only solution is Ctrl-Z and kill %1 so I guess that
works for now...
Cplusplus-sig mailing list
Cplusplus-sig at python.org
More information about the Cplusplus-sig