Skip to content

msvcrt SetErrorMode not documented #74481

Closed

Description

@giampaolo
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

Activity

  1. giampaolo commented on May 7, 2017

    @giampaolo
    ContributorAuthor

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

  2. eryksun commented on May 7, 2017

    @eryksun
    Contributor

    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.

  3. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-featureA feature request or enhancement
    and removed on Mar 6, 2021
  4. transferred this issue fromon Apr 10, 2022
  5. added a commit that references this issue on Sep 21, 2023
  6. aisk commented on Sep 22, 2023

    @aisk
    Member

    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?

  7. aisk commented on Sep 23, 2023

    @aisk
    Member

    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?

  8. added a commit that references this issue on Sep 28, 2023
  9. added a commit that references this issue on Sep 2, 2024
  10. added
    3.13only security fixes
    and removed on Feb 24, 2025
  11. terryjreedy commented on Feb 24, 2025

    @terryjreedy
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixesOS-windowsdocsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions