You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also SEM_FAILCRITICALERRORS and other SEM_constants. They should as setting error mode on Windows for console applications is a pretty common use case (in fact ./Lib/test/libregrtest/setup.py uses it).
msvcrt set_error_mode, CrtReportMode, CrtReportFile and the associated CRT constants should be documented for use with debug builds. Also, msvcrt is missing the set_error_mode constants _OUT_TO_DEFAULT, _OUT_TO_STDERR, _OUT_TO_MSGBOX, and _REPORT_ERRMODE.
SetErrorMode 1 and the SEM_* constants are defined in msvcrt, for convenience I suppose. They're not related to the CRT. I think they should be aliased in the os module and documented there. GetErrorMode 2 can also be provided in Python 3.5+. It would be useful to also provide SetThreadErrorMode 3 and GetThreadErrorMode conditionally in Windows 7+, which is practically all Windows users nowadays.
SetErrorMode 1 and the SEM_* constants are defined in msvcrt, for convenience I suppose. They're not related to the CRT. I think they should be aliased in the os module and documented there. GetErrorMode 2 can also be provided in Python 3.5+. It would be useful to also provide SetThreadErrorMode 3 and GetThreadErrorMode conditionally in Windows 7+, which is practically all Windows users nowadays.
Hi @eryksun , I have a question, the current Windows functions in the os module is normalized to snake_case like python functions. So if we want to alias to the os module, should we change the function name to something like get_error_mode?
Another thought is the SetErrorMode is only used in tests, so it was added in the msvcrt. But I think it's not so generic and widely used in the os module.
I think move it to the _winapi private module is more suitable?
Activity
giampaolo commentedon May 7, 2017
Also SEM_FAILCRITICALERRORS and other SEM_constants. They should as setting error mode on Windows for console applications is a pretty common use case (in fact ./Lib/test/libregrtest/setup.py uses it).
eryksun commentedon May 7, 2017
msvcrt set_error_mode, CrtReportMode, CrtReportFile and the associated CRT constants should be documented for use with debug builds. Also, msvcrt is missing the set_error_mode constants _OUT_TO_DEFAULT, _OUT_TO_STDERR, _OUT_TO_MSGBOX, and _REPORT_ERRMODE.
SetErrorMode 1 and the SEM_* constants are defined in msvcrt, for convenience I suppose. They're not related to the CRT. I think they should be aliased in the os module and documented there. GetErrorMode 2 can also be provided in Python 3.5+. It would be useful to also provide SetThreadErrorMode 3 and GetThreadErrorMode conditionally in Windows 7+, which is practically all Windows users nowadays.
gh-74481: Add missing debug function docs and constants to msvcrt (GH…
aisk commentedon Sep 22, 2023
Hi @eryksun , I have a question, the current Windows functions in the os module is normalized to
snake_caselike python functions. So if we want to alias to the os module, should we change the function name to something likeget_error_mode?aisk commentedon Sep 23, 2023
Another thought is the
SetErrorModeis only used in tests, so it was added in themsvcrt. But I think it's not so generic and widely used in theosmodule.I think move it to the
_winapiprivate module is more suitable?pythongh-74481: Add missing debug function docs and constants to msvc…
pythongh-74481: Add missing debug function docs and constants to msvc…
terryjreedy commentedon Feb 24, 2025
Merged into 3.13 (main) Sept 2023. 3.12 backport failed and not done.