Navigation Menu

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

WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle #72350

Closed
eryksun opened this issue Sep 15, 2016 · 3 comments
Closed

WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle #72350

eryksun opened this issue Sep 15, 2016 · 3 comments
Assignees
Labels
3.7 (EOL) end of life OS-windows stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error

Comments

@eryksun
Copy link
Contributor

eryksun commented Sep 15, 2016

BPO 28163
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • 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 = 'https://github.com/zooba'
    closed_at = <Date 2016-09-17.20:53:13.149>
    created_at = <Date 2016-09-15.03:26:21.248>
    labels = ['3.7', 'type-bug', 'library', 'expert-IO', 'OS-windows']
    title = 'WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle'
    updated_at = <Date 2017-03-31.16:36:12.311>
    user = 'https://github.com/eryksun'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:12.311>
    actor = 'dstufft'
    assignee = 'steve.dower'
    closed = True
    closed_date = <Date 2016-09-17.20:53:13.149>
    closer = 'steve.dower'
    components = ['Library (Lib)', 'Windows', 'IO']
    creation = <Date 2016-09-15.03:26:21.248>
    creator = 'eryksun'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 28163
    keywords = []
    message_count = 3.0
    messages = ['276509', '276840', '276846']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'python-dev', 'zach.ware', 'eryksun', 'steve.dower']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue28163'
    versions = ['Python 3.6', 'Python 3.7']

    @eryksun
    Copy link
    Contributor Author

    eryksun commented Sep 15, 2016

    WindowsConsoleIO fileno() gets a file descriptor on demand by calling _open_osfhandle. As a low I/O function this expects _open flags, but currently the code is passing 'rb' (int 0x7262) and 'wb' (int 0x7762). It should use _O_RDONLY | _O_BINARY and _O_WRONLY | _O_BINARY.

    Actually, _open_osfhandle isn't actually opening the file, so it only cares about a few flags. Specifically, in lowio\osfinfo.cpp I see that it looks for _O_APPEND, _O_TEXT, and _O_NOINHERIT. So in this case passing 0 for the flags would also be ok.

    @eryksun eryksun added 3.7 (EOL) end of life stdlib Python modules in the Lib dir OS-windows topic-IO type-bug An unexpected behavior, bug, or error labels Sep 15, 2016
    @zooba
    Copy link
    Member

    zooba commented Sep 17, 2016

    I'll pass the "correct" flags, since the docs don't specify that they aren't used, which means one day they might become relevant.

    @zooba zooba self-assigned this Sep 17, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 17, 2016

    New changeset d0bab9fda568 by Steve Dower in branch '3.6':
    Issue bpo-28161: Opening CON for write access fails
    https://hg.python.org/cpython/rev/d0bab9fda568

    New changeset 187a114b9ef4 by Steve Dower in branch 'default':
    Issue bpo-28161: Opening CON for write access fails
    https://hg.python.org/cpython/rev/187a114b9ef4

    @zooba zooba closed this as completed Sep 17, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life OS-windows stdlib Python modules in the Lib dir topic-IO type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants