[issue3545] Python turning off assertions (Windows)
Anders Bensryd
report at bugs.python.org
Thu Aug 14 11:48:18 CEST 2008
Anders Bensryd <anders.bensryd at aveva.com> added the comment:
We started using Python 2.5.2 recently and a few developers have
complained that they do not get any assertions anymore so yes, we do
use _ASSERT() and _ASSERTE(), but after a brief look it seems as if we
mainly use assert(). The developer using _ASSERT() cannot remember why
this was necessary and the tests I have made today shows that we could
probably move to assert() everywhere.
A more interesting aspect is that we have recently moved the the more
secure CRT routines (strcpy_s etc) and tests have shown issues with
these if we turn off assertions:
int prevCrtReportMode=_CrtSetReportMode(_CRT_ASSERT,0);
char str[8];
strcpy_s(str,"123456789");
With assertions turned on, I get an assertion dialog saying "Buffer is
too small" which is what I expect and want. With assertions turned off
(as in the example above), I get a dialog saying "Microsoft Visual
Studio C Runtime Library has detected a fatal error in crt.exe.".
The stack is still useful and we can find the cause of the error so it
is not a serious problem for us since we will continue to turn on
assertions after Py_Initialize().
I have not yet seen any examples where the are erroneous assertions.
Anyway, you have made your point and I really do not want to take up
anymore of your time. I respect your opinion and at least I have forced
you to think about this. We have a workaround that works for us so I am
OK with closing this issue.
Many thanks!
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3545>
_______________________________________
More information about the Python-bugs-list
mailing list