This work was produced with the help of language models.
Python runs its SIGINT handler only between bytecodes. While the main thread waits in the engine for execute(), query() or query_as_arrow(), Ctrl-C has no effect until the query finishes. With SIGINT sent 1 s into a query that runs for 15-18 s, KeyboardInterrupt appeared only when the query finished, 15-18 s after it started.
import ladybug as lb
conn = lb.Connection(lb.Database(":memory:"))
# Runs for many seconds; press Ctrl-C while it does.
conn.execute("WITH range(1, 40000) AS r UNWIND r AS x UNWIND r AS y RETURN sum(x * y)")
Expected: the query is interrupted and KeyboardInterrupt is raised promptly; the connection stays usable.
Actual: the query runs to the end; KeyboardInterrupt is raised only after it has finished.
Reproduced on main (548c183) with CPython 3.12. The fix covers the pybind backend on POSIX; the C-API backend calls the engine through ctypes and is not covered.
Fix: #66
This work was produced with the help of language models.
Python runs its SIGINT handler only between bytecodes. While the main thread waits in the engine for
execute(),query()orquery_as_arrow(), Ctrl-C has no effect until the query finishes. With SIGINT sent 1 s into a query that runs for 15-18 s,KeyboardInterruptappeared only when the query finished, 15-18 s after it started.Expected: the query is interrupted and
KeyboardInterruptis raised promptly; the connection stays usable.Actual: the query runs to the end;
KeyboardInterruptis raised only after it has finished.Reproduced on
main(548c183) with CPython 3.12. The fix covers the pybind backend on POSIX; the C-API backend calls the engine through ctypes and is not covered.Fix: #66