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

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

Closed
pitrou opened this issue Mar 24, 2009 · 5 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Mar 24, 2009

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']

@pitrou
Copy link
Member Author

pitrou commented Mar 24, 2009

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

>>> import os
>>> print(os.device_encoding(1000))
None

@pitrou pitrou added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Mar 24, 2009
@pitrou
Copy link
Member Author

pitrou commented Mar 24, 2009

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

@pitrou
Copy link
Member Author

pitrou commented Mar 24, 2009

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

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

@kristjanvalur
Copy link
Mannequin

kristjanvalur mannequin commented Mar 24, 2009

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

@pitrou
Copy link
Member Author

pitrou commented Mar 24, 2009

Thanks!

@pitrou pitrou closed this as completed Mar 24, 2009
@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
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant