Steve Dower added the comment: To be clearer (while still respecting the confidentiality agreement I'm under), previously this code would (if _DEBUG) display an assertion dialog and (regardless of _DEBUG) terminate the process:
close(fd); // succeeds, assuming a good fd close(fd); // crashes here This code would not display the dialog, but would still terminate: _CrtSetReportMode(_CRT_ASSERT, 0); close(fd); close(fd); This code would not display the dialog or terminate, but depends on knowing implementation details of the CRT: if (!_PyVerify_fd(fd)) return posix_error() res = close(fd); if (res < 0) return posix_error() if (!_PyVerify_fd(fd)) return posix_error() res = close(fd); if (res < 0) return posix_error() Soon we'll have a safe way (including in the presence of threads) to do this: _DONT_TERMINATE_ON_INVALID_PARAMETER_ON_THIS_THREAD res = close(fd); if (res < 0) return posix_error() res = close(fd); // would have terminated, but now returns EBADF if (res < 0) return posix_error() _ALLOW_TERMINATE_ON_INVALID_PARAMETER_ON_THIS_THREAD In the last case, we prevent termination but can't safely suppress the _DEBUG dialog in the same way. SuppressCrashHandler works for its purpose, since the OS error mode is inherited by child processes. The _CrtSetReportMode setting is *not* inherited, and so it needs to be called in every child process created by tests. Maybe it's possible to add the call into every test, but I'm skeptical (especially considering the multiprocessing tests). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23314> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com