changeset: 83614:0201d8fa8bd0 branch: 2.7 parent: 83611:74e1c50498f8 user: Antoine Pitrou date: Sat May 04 23:16:59 2013 +0200 files: Misc/NEWS Modules/signalmodule.c description: Issue #14173: Avoid crashing when reading a signal handler during interpreter shutdown. diff -r 74e1c50498f8 -r 0201d8fa8bd0 Misc/NEWS --- a/Misc/NEWS Sat May 04 20:18:34 2013 +0200 +++ b/Misc/NEWS Sat May 04 23:16:59 2013 +0200 @@ -34,6 +34,9 @@ Library ------- +- Issue #14173: Avoid crashing when reading a signal handler during + interpreter shutdown. + - Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. - Issue #17192: Restore the patch for Issue #10309 which was ommitted diff -r 74e1c50498f8 -r 0201d8fa8bd0 Modules/signalmodule.c --- a/Modules/signalmodule.c Sat May 04 20:18:34 2013 +0200 +++ b/Modules/signalmodule.c Sat May 04 23:16:59 2013 +0200 @@ -321,7 +321,10 @@ Handlers[sig_num].tripped = 0; Py_INCREF(obj); Handlers[sig_num].func = obj; - return old_handler; + if (old_handler != NULL) + return old_handler; + else + Py_RETURN_NONE; } PyDoc_STRVAR(signal_doc, @@ -349,8 +352,13 @@ return NULL; } old_handler = Handlers[sig_num].func; - Py_INCREF(old_handler); - return old_handler; + if (old_handler != NULL) { + Py_INCREF(old_handler); + return old_handler; + } + else { + Py_RETURN_NONE; + } } PyDoc_STRVAR(getsignal_doc,

AltStyle によって変換されたページ (->オリジナル) /