[Python-Dev] Test failures under Windows?
David Bolen
db3l.net at gmail.com
Wed Mar 25 17:50:31 CET 2009
Curt Hagenlocher <curt at hagenlocher.org> writes:
> The variation that goes through assert.c should write to stderr for a
> console-mode application, so it's reasonable to assume that we're
> hitting the other code path -- and that Mark's suggestion to use
> CrtSetReportMode would address the issue.
Which is pretty much what the regrtest.py -n option does/did in the
py3k branch (and release30-maint). It enables the following code:
import msvcrt
msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS|
msvcrt.SEM_NOALIGNMENTFAULTEXCEPT|
msvcrt.SEM_NOGPFAULTERRORBOX|
msvcrt.SEM_NOOPENFILEERRORBOX)
try:
msvcrt.CrtSetReportMode
except AttributeError:
# release build
pass
else:
for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
which seems like it would still be the right sort of code to use. For
my buildbot the SetErrorMode is redundant because I already do that in the
buildbot code itself (and the setting is inherited) but it won't hurt.
>From what I can see though, the tools/buildbot/test.bat file no longer
adds the -n option that it used to, although I'm unclear on why it
might have been removed. Perhaps this was just a regression that was
accidentally missed, as it appears to have disappeared during a large
merger from trunk to the py3k branch mid-2008 (r64273) when the batch
file line ending was changed to CRLF.
It would be nice to also have this in the other active release branches.
-- David
More information about the Python-Dev
mailing list