From ea7b748891e32974876c9ad04224f77f82e2520a Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Mon, 17 May 2010 16:59:23 +0000 Subject: [PATCH] Fix test_capi in !pydebug mode, where my original attempt segfaulted without producing the expected error message. The test only tests what it's supposed to test in pydebug mode though. Fixes issue 8726. --- Modules/_testcapimodule.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index ba81f717d4..e1dc5f4aa9 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2011,7 +2011,11 @@ static PyObject * crash_no_current_thread(PyObject *self) { Py_BEGIN_ALLOW_THREADS - PyErr_SetString(PyExc_SystemError, "bork bork bork"); + /* Using PyThreadState_Get() directly allows the test to pass in + !pydebug mode. However, the test only actually tests anything + in pydebug mode, since that's where the infinite loop was in + the first place. */ + PyThreadState_Get(); Py_END_ALLOW_THREADS return NULL; } -- 2.50.1