classification
Title: With invalid FD, os.device_encoding() returns None under Linux but raises an error under Windows
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.0, Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: kristjan.jonsson, pitrou
Priority: normal Keywords:

Created on 2009-03-24 13:42 by pitrou, last changed 2009-03-24 14:18 by pitrou. This issue is now closed.

Messages (5)
msg84079 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-03-24 13:42
This is a potentially annoying incompatibility between platforms.
Under Linux:

>>> import os
>>> print(os.device_encoding(1000))
None
msg84080 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-03-24 13:42
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
msg84083 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-03-24 13:56
This may be related to the following lines in posixmodule.c:

if (!_PyVerify_fd(fd))
	return posix_error();
msg84085 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-03-24 14:16
Right, None is clearly the right result.  Fixed in revision 70581
msg84086 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-03-24 14:18
Thanks!
History
Date User Action Args
2009-03-24 14:18:52pitrousetstatus: open -> closed

messages: + msg84086
2009-03-24 14:16:23kristjan.jonssonsetresolution: fixed
messages: + msg84085
2009-03-24 13:56:54pitrousetnosy: + kristjan.jonsson
messages: + msg84083
2009-03-24 13:42:36pitrousetmessages: + msg84080
2009-03-24 13:42:04pitroucreate