summaryrefslogtreecommitdiffstats
path: root/PC/msvcrtmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-10 16:49:23 (GMT)
committerGitHub <noreply@github.com>2020-06-10 16:49:23 (GMT)
commitf6e58aefde2e57e4cb11ea7743955da53a3f1e80 (patch)
treeae5a760fc2db639f50d8a08e600267b865ac852c /PC/msvcrtmodule.c
parentd36cf5f1d20ce9f111a8fc997104785086e8eee6 (diff)
downloadcpython-f6e58aefde2e57e4cb11ea7743955da53a3f1e80.zip
cpython-f6e58aefde2e57e4cb11ea7743955da53a3f1e80.tar.gz
cpython-f6e58aefde2e57e4cb11ea7743955da53a3f1e80.tar.bz2
bpo-40826: Fix test_repl.test_close_stdin() on Windows (GH-20779)
test_repl.test_close_stdin() now calls support.suppress_msvcrt_asserts() to fix the test on Windows. * Move suppress_msvcrt_asserts() from test.libregrtest.setup to test.support. Make its verbose parameter optional: verbose=False by default. * Add msvcrt.GetErrorMode(). * SuppressCrashReport now uses GetErrorMode() and SetErrorMode() of the msvcrt module, rather than using ctypes. * Remove also an unused variable (deadline) in wait_process().
Diffstat (limited to 'PC/msvcrtmodule.c')
-rw-r--r--PC/msvcrtmodule.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index faceb03..b7ff20a 100644
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -483,6 +483,25 @@ msvcrt_set_error_mode_impl(PyObject *module, int mode)
#endif /* _DEBUG */
/*[clinic input]
+msvcrt.GetErrorMode
+
+Wrapper around GetErrorMode.
+[clinic start generated code]*/
+
+static PyObject *
+msvcrt_GetErrorMode_impl(PyObject *module)
+/*[clinic end generated code: output=3103fc6145913591 input=5a7fb083b6dd71fd]*/
+{
+ unsigned int res;
+
+ _Py_BEGIN_SUPPRESS_IPH
+ res = GetErrorMode();
+ _Py_END_SUPPRESS_IPH
+
+ return PyLong_FromUnsignedLong(res);
+}
+
+/*[clinic input]
msvcrt.SetErrorMode
mode: unsigned_int(bitwise=True)
@@ -520,6 +539,7 @@ static struct PyMethodDef msvcrt_functions[] = {
MSVCRT_GETCHE_METHODDEF
MSVCRT_PUTCH_METHODDEF
MSVCRT_UNGETCH_METHODDEF
+ MSVCRT_GETERRORMODE_METHODDEF
MSVCRT_SETERRORMODE_METHODDEF
MSVCRT_CRTSETREPORTFILE_METHODDEF
MSVCRT_CRTSETREPORTMODE_METHODDEF