Skip to content

msvcrt SetErrorMode not documented #74481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
giampaolo opened this issue May 7, 2017 · 5 comments
Closed

msvcrt SetErrorMode not documented #74481

giampaolo opened this issue May 7, 2017 · 5 comments
Labels
3.13 bugs and security fixes docs Documentation in the Doc dir OS-windows stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@giampaolo
Copy link
Contributor

giampaolo commented May 7, 2017

BPO 30295
Nosy @pfmoore, @giampaolo, @tjguk, @zware, @eryksun, @zooba

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2017-05-07.12:24:20.777>
labels = ['3.8', '3.9', '3.10', 'type-feature', 'library', 'OS-windows', 'docs']
title = 'msvcrt SetErrorMode not documented'
updated_at = <Date 2021-03-06.15:34:24.241>
user = 'https://github.com/giampaolo'

bugs.python.org fields:

activity = <Date 2021-03-06.15:34:24.241>
actor = 'eryksun'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'Library (Lib)', 'Windows']
creation = <Date 2017-05-07.12:24:20.777>
creator = 'giampaolo.rodola'
dependencies = []
files = []
hgrepos = []
issue_num = 30295
keywords = []
message_count = 2.0
messages = ['293189', '293200']
nosy_count = 7.0
nosy_names = ['paul.moore', 'giampaolo.rodola', 'tim.golden', 'docs@python', 'zach.ware', 'eryksun', 'steve.dower']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue30295'
versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

Linked PRs

@giampaolo
Copy link
Contributor Author

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).

@giampaolo giampaolo added the 3.7 (EOL) end of life label May 7, 2017
@giampaolo giampaolo added the docs Documentation in the Doc dir label May 7, 2017
@eryksun
Copy link
Contributor

eryksun commented 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.

@eryksun eryksun added stdlib Python modules in the Lib dir 3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes type-feature A feature request or enhancement and removed 3.7 (EOL) end of life labels Mar 6, 2021
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@aisk
Copy link
Contributor

aisk commented Sep 22, 2023

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?

@aisk
Copy link
Contributor

aisk commented Sep 23, 2023

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?

@terryjreedy terryjreedy added 3.13 bugs and security fixes and removed 3.10 only security fixes 3.9 only security fixes 3.8 (EOL) end of life labels Feb 24, 2025
@terryjreedy
Copy link
Member

Merged into 3.13 (main) Sept 2023. 3.12 backport failed and not done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes docs Documentation in the Doc dir OS-windows stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
Status: Todo
Development

No branches or pull requests

4 participants