Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Pycurl ignores SIGINT when HEADERFUNCTION is used #413
Minimal python 3 code to reproduce the problem
When I run it and press Ctrl + C the script does not stop working. I have to press Ctrl + C and wait a few second until accidentally one of SIGINT signals is processed correctly. Example of script output:
Thanks for the reproduce code. I suppose the debugfunction callback in pycurl needs to check Python exceptions prior to returning.
The catch here is that libcurl does not allow debug callback to fail - hence I imagine pycurl would need to store the failure flag and fail the overarching perform. This potentially causes its own issues as, for example, the perform might be for a POST/PUT/DELETE which completely succeeded but pycurl would report failure due to the debug callback failing.
This delayed failure may be even more complicated/less feasible for async calls (multi interface).
OK, let's forget about DEBUGFUNCTION and VERBOSE. These things are not commonly used.
The HEADERFUNCTION :)
Start the script, then start pressing Ctrl+C. You'll see that
In practice such pycurl behaviour leads to different errors. For example, I can't stop execution of Grab tests because most of my Ctrl+C signals are caught by HEADERFUNCTION and converted into pycurl.error which is not fatal for unittest runner.
That is true for WRITEFUNCTION also.