[New-bugs-announce] [issue5619] Pass MS CRT debug flags into subprocesses

"Martin v. Löwis" <report@bugs.python.org> at psf.upfronthosting.co.za "Martin v. Löwis" <report@bugs.python.org> at psf.upfronthosting.co.za
Tue Mar 31 06:13:03 CEST 2009

New submission from Martin v. Löwis <martin at v.loewis.de>:

To avoid bringing up CRT assert message dialogs, the CRT debug flags 
need to be passed into subprocesses for multiprocessing.

CRT doesn't have getters. Instead, you have to set to 0, get the current 
value, then restore it. This can be done with

modes = []
for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
    oldmode = msvcrt.CrtSetReportMode(m, 0)
    msvcrt.CrtSetReportMode(m, oldmode)
    modes.append((m, oldmode))

The same probably needs to be done for CrtSetReportFile, except
that msvcrt.CrtSetReportFile currently doesn't return the previous
value. (Also, it returns a HFILE - hopefully, the file handle value
will still be valid in the subprocess)

messages: 84750
nosy: asvetlov, jnoller, loewis
severity: normal
status: open
title: Pass MS CRT debug flags into subprocesses

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list