[New-bugs-announce] [issue20431] Should posix functions that accept fd also accept objects with .fileno()?
report at bugs.python.org
Wed Jan 29 04:48:20 CET 2014
New submission from Larry Hastings:
While working on posixmodule.c today I noticed that some functions that accept file descriptors call PyObject_AsFileDescriptor(). This function accepts ints. It *also* accepts objects that expose a .fileno() attribute, calling that attribute and using the integer it returns.
There are *other* functions in posixmodule.c that accept file descriptors that call _fd_converter(), which just looks for an int with a proper value.
I figure it should be one way or the other. Should everything in posix that accepts file descriptor ints accept the .fileno() convention too?
stage: needs patch
title: Should posix functions that accept fd also accept objects with .fileno()?
versions: Python 3.5
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce