Skip to content
Permalink
Browse files

bpo-33623: Fix possible SIGSGV when asyncio.Future is created in __de…

…l__ (GH-7080)

(cherry picked from commit 35230d0)

Co-authored-by: Yury Selivanov <yury@magic.io>
  • Loading branch information
miss-islington and 1st1 committed May 28, 2018
1 parent 983c1ba commit 51d0a2c8ddcb9f58d71ff0a62be4e31a1af3f139
Showing with 8 additions and 1 deletion.
  1. +1 −0 Misc/NEWS.d/next/Library/2018-05-23-14-58-05.bpo-33623.wAw1cF.rst
  2. +7 −1 Modules/_asynciomodule.c
@@ -0,0 +1 @@
Fix possible SIGSGV when asyncio.Future is created in __del__
@@ -501,7 +501,13 @@ future_init(FutureObj *fut, PyObject *loop)
if (is_true < 0) {
return -1;
}
if (is_true) {
if (is_true && !_Py_IsFinalizing()) {
/* Only try to capture the traceback if the interpreter is not being
finalized. The original motivation to add a `_Py_IsFinalizing()`
call was to prevent SIGSEGV when a Future is created in a __del__
method, which is called during the interpreter shutdown and the
traceback module is already unloaded.
*/
fut->fut_source_tb = _PyObject_CallNoArg(traceback_extract_stack);
if (fut->fut_source_tb == NULL) {
return -1;

0 comments on commit 51d0a2c

Please sign in to comment.
You can’t perform that action at this time.