Skip to content

With invalid FD, os.device_encoding() returns None under Linux but raises an error under Windows #49802

Description

@pitrou
BPO 5552
Nosy @pitrou, @kristjanvalur

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 2009-03-24.14:18:52.082>
created_at = <Date 2009-03-24.13:42:04.236>
labels = ['interpreter-core', 'type-bug']
title = 'With invalid FD, os.device_encoding() returns None under Linux but raises an error under Windows'
updated_at = <Date 2009-03-24.14:18:52.080>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2009-03-24.14:18:52.080>
actor = 'pitrou'
assignee = 'none'
closed = True
closed_date = <Date 2009-03-24.14:18:52.082>
closer = 'pitrou'
components = ['Interpreter Core']
creation = <Date 2009-03-24.13:42:04.236>
creator = 'pitrou'
dependencies = []
files = []
hgrepos = []
issue_num = 5552
keywords = []
message_count = 5.0
messages = ['84079', '84080', '84083', '84085', '84086']
nosy_count = 2.0
nosy_names = ['pitrou', 'kristjan.jonsson']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue5552'
versions = ['Python 3.0', 'Python 3.1']

Activity

  1. pitrou commented on Mar 24, 2009

    @pitrou
    MemberAuthor

    This is a potentially annoying incompatibility between platforms.
    Under Linux:

    >>> import os
    >>> print(os.device_encoding(1000))
    None
  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-bugAn unexpected behavior, bug, or error
    on Mar 24, 2009
  3. pitrou commented on Mar 24, 2009

    @pitrou
    MemberAuthor

    And under Windows:

    >>> print(os.device_encoding(1000))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: [Errno 9] Bad file descriptor
  4. pitrou commented on Mar 24, 2009

    @pitrou
    MemberAuthor

    This may be related to the following lines in posixmodule.c:

    if (!_PyVerify_fd(fd))
    return posix_error();

  5. kristjanvalur commented on Mar 24, 2009

    kristjanvalurmannequin
    Mannequin

    Right, None is clearly the right result. Fixed in revision 70581

  6. pitrou commented on Mar 24, 2009

    @pitrou
    MemberAuthor

    Thanks!

  7. transferred this issue fromon Apr 10, 2022
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions