Staging
v0.5.1
https://github.com/python/cpython
Revision 38f11cc3f62db11a4a24354bd06273322ac91afa authored by Gregory P. Smith on 16 February 2019, 20:57:40 UTC, committed by GitHub on 16 February 2019, 20:57:40 UTC
* bpo-1054041: Exit properly by a signal after a ^C.

An uncaught KeyboardInterrupt exception means the user pressed ^C and
our code did not handle it.  Programs that install SIGINT handlers are
supposed to reraise the SIGINT signal to the SIG_DFL handler in order
to exit in a manner that their calling process can detect that they
died due to a Ctrl-C.  https://www.cons.org/cracauer/sigint.html

After this change on POSIX systems

 while true; do python -c 'import time; time.sleep(23)'; done

can be stopped via a simple Ctrl-C instead of the shell infinitely
restarting a new python process.

What to do on Windows, or if anything needs to be done there has not
yet been determined.  That belongs in its own PR.

TODO(gpshead): A unittest for this behavior is still needed.

* Do the unhandled ^C check after pymain_free.

* Return STATUS_CONTROL_C_EXIT on Windows.

* Fix ifdef around unistd.h include.

* 📜🤖 Added by blurb_it.

* Add STATUS_CTRL_C_EXIT to the os module on Windows

* Add unittests.

* Don't send CTRL_C_EVENT in the Windows test.

It was causing CI systems to bail out of the entire test suite.

See https://dev.azure.com/Python/cpython/_build/results?buildId=37980
for example.

* Correct posix test (fail on macOS?) check.

* STATUS_CONTROL_C_EXIT must be unsigned.

* Improve the error message.

* test typo :)

* Skip if the bash version is too old.

...and rename the windows test to reflect what it does.

* min bash version is 4.4, detect no bash.

* restore a blank line i didn't mean to delete.

* PyErr_Occurred() before the Py_DECREF(co);

* Don't add os.STATUS_CONTROL_C_EXIT as a constant.

* Update the Windows test comment.

* Refactor common logic into a run_eval_code_obj fn.
1 parent 43766f8
History
Tip revision: 38f11cc3f62db11a4a24354bd06273322ac91afa authored by Gregory P. Smith on 16 February 2019, 20:57:40 UTC
bpo-1054041: Exit properly after an uncaught ^C. (#11862)
Tip revision: 38f11cc
File Mode Size
clinic
stringlib
README -rw-r--r-- 41 bytes
abstract.c -rw-r--r-- 68.0 KB
accu.c -rw-r--r-- 2.4 KB
boolobject.c -rw-r--r-- 6.5 KB
bytearrayobject.c -rw-r--r-- 69.5 KB
bytes_methods.c -rw-r--r-- 21.1 KB
bytesobject.c -rw-r--r-- 99.0 KB
call.c -rw-r--r-- 37.1 KB
capsule.c -rw-r--r-- 7.3 KB
cellobject.c -rw-r--r-- 5.7 KB
classobject.c -rw-r--r-- 17.7 KB
codeobject.c -rw-r--r-- 27.6 KB
complexobject.c -rw-r--r-- 32.4 KB
descrobject.c -rw-r--r-- 54.3 KB
dict-common.h -rw-r--r-- 2.2 KB
dictnotes.txt -rw-r--r-- 6.0 KB
dictobject.c -rw-r--r-- 134.5 KB
enumobject.c -rw-r--r-- 13.4 KB
exceptions.c -rw-r--r-- 87.4 KB
fileobject.c -rw-r--r-- 15.1 KB
floatobject.c -rw-r--r-- 71.1 KB
frameobject.c -rw-r--r-- 32.7 KB
funcobject.c -rw-r--r-- 29.8 KB
genobject.c -rw-r--r-- 64.7 KB
iterobject.c -rw-r--r-- 9.2 KB
listobject.c -rw-r--r-- 97.1 KB
listsort.txt -rw-r--r-- 35.3 KB
lnotab_notes.txt -rw-r--r-- 5.7 KB
longobject.c -rw-r--r-- 169.6 KB
memoryobject.c -rw-r--r-- 90.5 KB
methodobject.c -rw-r--r-- 9.0 KB
moduleobject.c -rw-r--r-- 24.6 KB
namespaceobject.c -rw-r--r-- 7.3 KB
object.c -rw-r--r-- 60.2 KB
obmalloc.c -rw-r--r-- 83.3 KB
odictobject.c -rw-r--r-- 73.6 KB
rangeobject.c -rw-r--r-- 34.6 KB
setobject.c -rw-r--r-- 73.2 KB
sliceobject.c -rw-r--r-- 19.1 KB
structseq.c -rw-r--r-- 13.6 KB
tupleobject.c -rw-r--r-- 31.1 KB
typeobject.c -rw-r--r-- 239.8 KB
typeslots.inc -rw-r--r-- 3.9 KB
typeslots.py -rwxr-xr-x 1.2 KB
unicodectype.c -rw-r--r-- 7.5 KB
unicodeobject.c -rw-r--r-- 453.5 KB
unicodetype_db.h -rw-r--r-- 241.6 KB
weakrefobject.c -rw-r--r-- 29.5 KB

README

back to top