Skip to content
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

[Windows] OSError should unconditionally call winerror_to_errno #90931

Closed
eryksun opened this issue Feb 17, 2022 · 6 comments
Closed

[Windows] OSError should unconditionally call winerror_to_errno #90931

eryksun opened this issue Feb 17, 2022 · 6 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes easy interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error

Comments

@eryksun
Copy link
Contributor

eryksun commented Feb 17, 2022

BPO 46775
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba, @corona10, @miss-islington
PRs
  • bpo-46775: OSError should call winerror_to_errno unconditionally #32179
  • [3.10] bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179) #32198
  • [3.9] bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179) #32199
  • 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 = <Date 2022-03-31.02:51:30.988>
    created_at = <Date 2022-02-17.03:54:21.496>
    labels = ['interpreter-core', 'easy', 'type-bug', '3.9', '3.10', '3.11', 'OS-windows']
    title = '[Windows] OSError should unconditionally call winerror_to_errno'
    updated_at = <Date 2022-03-31.02:51:30.987>
    user = 'https://github.com/eryksun'

    bugs.python.org fields:

    activity = <Date 2022-03-31.02:51:30.987>
    actor = 'corona10'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-03-31.02:51:30.988>
    closer = 'corona10'
    components = ['Interpreter Core', 'Windows']
    creation = <Date 2022-02-17.03:54:21.496>
    creator = 'eryksun'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46775
    keywords = ['patch', 'easy (C)']
    message_count = 6.0
    messages = ['413383', '416282', '416387', '416393', '416411', '416412']
    nosy_count = 7.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'eryksun', 'steve.dower', 'corona10', 'miss-islington']
    pr_nums = ['32179', '32198', '32199']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46775'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @eryksun
    Copy link
    Contributor Author

    eryksun commented Feb 17, 2022

    bpo-37705 overlooked fixing the OSError constructor. oserror_parse_args() in Objects/exceptions.c should unconditionally call winerror_to_errno(), which is defined in PC/errmap.h.

    winerror_to_errno() maps the Winsock range 10000-11999 directly, except for the 6 errors in this range that are based on C errno values: WSAEINTR, WSAEBADF, WSAEACCES, WSAEFAULT, WSAEINVAL, and WSAEMFILE. Otherwise, Windows error codes that aren't mapped explicitly get mapped by default to EINVAL.

    @eryksun eryksun added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows easy type-bug An unexpected behavior, bug, or error labels Feb 17, 2022
    @zooba
    Copy link
    Member

    zooba commented Mar 29, 2022

    Is this okay to backport? Correcting more winerror values means we'll get more subclasses raised instead of OSError (though only for obscure cases, which probably also aren't mapped, so I guess it's possible to prove that none will actually change right now).

    @zooba
    Copy link
    Member

    zooba commented Mar 30, 2022

    New changeset d0c67ea by Dong-hee Na in branch 'main':
    bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
    d0c67ea

    @zooba
    Copy link
    Member

    zooba commented Mar 30, 2022

    I'm still not convinced we should backport. Has anyone looked through to see whether this will actually affect any high valued error codes today?

    @miss-islington
    Copy link
    Contributor

    New changeset 1f2ec4c by Miss Islington (bot) in branch '3.10':
    bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
    1f2ec4c

    @miss-islington
    Copy link
    Contributor

    New changeset d04a213 by Miss Islington (bot) in branch '3.9':
    bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179)
    d04a213

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes easy interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants