This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abe
Recipients abe
Date 2008-08-12.10:05:28
SpamBayes Score 7.715884e-09
Marked as misclassified No
Message-id <1218535531.94.0.182570624972.issue3545@psf.upfronthosting.co.za>
In-reply-to
Content
We are using Windows XP SP2, Visual Studio 2005 & Python 2.5.2.
In Objects/exceptions.c the following code turns off all assertions.

#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
    /* Set CRT argument error handler */
    prevCrtHandler = _set_invalid_parameter_handler
(InvalidParameterHandler);
    /* turn off assertions in debug mode */
    prevCrtReportMode = _CrtSetReportMode(_CRT_ASSERT, 0);
#endif

As far as I understand, this is to make sure that no assertion dialogs 
pop up during the internal Python tests. For ordinary users, this is 
not an issue.

However, we are using the Python DLL in our product and when developing 
we always use the debug version of the Python DLL (as recommended). 
When we do Py_Initialize() all assertions are turned off, even our 
assertions, and this is not what we want. The current workaround is as 
follows (this is in our code):

   prevCrtReportMode=_CrtSetReportMode(_CRT_ASSERT,_CRTDBG_REPORT_MODE);
   Py_Initialize();
   prevCrtReportMode=_CrtSetReportMode(_CRT_ASSERT,prevCrtReportMode);

I am not certain if this is a bug or a feature and I really do not have 
a suggested solution since I do not know the real reasons for turning 
off assertions. Perhaps there already is a way to avoid this problem 
that I have not found?

All comments are appreciated.
History
Date User Action Args
2008-08-12 10:05:32abesetrecipients: + abe
2008-08-12 10:05:31abesetmessageid: <1218535531.94.0.182570624972.issue3545@psf.upfronthosting.co.za>
2008-08-12 10:05:30abelinkissue3545 messages
2008-08-12 10:05:28abecreate