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 vstinner
Recipients larry, serhiy.storchaka, steve.dower, tim.golden, vstinner, zach.ware
Date 2015-02-27.16:40:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1425055259.64.0.158597420464.issue23524@psf.upfronthosting.co.za>
In-reply-to
Content
> I considered that, but then we'll be disabling the handler for calls into external modules (assuming whatever pyd layer exists is doing its job correctly), which is exactly where the error is most relevant.

Hum ok. So I try to rephrase the issue.

When Python is compiled in debug mode, the Windows C runtime (CRT) kills the process when a fault is detected. A fault can be an invalid memory access, a C assertion ("assert(...);") which failed, etc. The problem is that the Python test suite explicitly call functions with invalid parameters to check that Python "handles correctly" errors. The problem is that unit tests expect that Python raises an exception, while the CRT kills the process by default.

You propose to modify the behaviour of the CRT of the current thread in the os module to raise a regular exception, instead of killing the process.

I agree with your suggestion :-)

We already use _PyVerify_fd() to raises an OSError(EBADF) exception, instead of killing the process when functions like os.close() are called with an invalid file descriptor.

We cannot disable globally CRT checks because users want them (#3545 and #4804) to validate their own C libraries. So CRT checks should only be disabled temporary when a Python function of the stdlib is called. We expect that calling a third party function kills the process if it is called with an invalid parameter. It's the purpose of the debug build.

(I didn't review the patch yet.)

Note: "kill the process" probably means that Windows opens a popup to ask to debug the application when a debugger is installed, instead of killing silently the application.
History
Date User Action Args
2015-02-27 16:40:59vstinnersetrecipients: + vstinner, larry, tim.golden, zach.ware, serhiy.storchaka, steve.dower
2015-02-27 16:40:59vstinnersetmessageid: <1425055259.64.0.158597420464.issue23524@psf.upfronthosting.co.za>
2015-02-27 16:40:59vstinnerlinkissue23524 messages
2015-02-27 16:40:59vstinnercreate