Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2979)

Unified Diff: Modules/_testcapimodule.c

Issue 9116: test_capi.test_no_FatalError_infinite_loop crash on Windows
Patch Set: Created 2 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Python/pythonrun.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Modules/_testcapimodule.c
===================================================================
--- Modules/_testcapimodule.c (revision 84639)
+++ Modules/_testcapimodule.c (working copy)
@@ -11,6 +11,9 @@
#include <float.h>
#include "structmember.h"
#include "datetime.h"
+#if defined(_MSC_VER) && _MSC_VER < 1400
+#include <crtdbg.h>
+#endif
#ifdef WITH_THREAD
#include "pythread.h"
@@ -2183,6 +2186,16 @@
static PyObject *
crash_no_current_thread(PyObject *self)
{
+#ifdef _MSC_VER
+ /* PyThreadState_Get() will halt via abort(). Following function
+ call is needed to supress popup of the dialog box */
+# if _MSC_VER >= 1400
+ _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
+# else
+ /* XXX: abort() prints "abnormal program termination" */
+ _CrtSetReportMode(_CRT_ERROR, 0);
+# endif
+#endif
Py_BEGIN_ALLOW_THREADS
/* Using PyThreadState_Get() directly allows the test to pass in
!pydebug mode. However, the test only actually tests anything
« no previous file with comments | « no previous file | Python/pythonrun.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7