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 steve.dower
Recipients steve.dower, tim.golden, vstinner, zach.ware
Date 2015-02-12.16:05:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1423757156.5.0.283729887885.issue23314@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2015-02-12 16:05:56steve.dowersetrecipients: + steve.dower, vstinner, tim.golden, zach.ware
2015-02-12 16:05:56steve.dowersetmessageid: <1423757156.5.0.283729887885.issue23314@psf.upfronthosting.co.za>
2015-02-12 16:05:56steve.dowerlinkissue23314 messages
2015-02-12 16:05:56steve.dowercreate