[New-bugs-announce] [issue10345] fcntl.ioctl always fails claiming an invalid fd
Ben Gamari
report at bugs.python.org
Sun Nov 7 02:16:44 CET 2010
New submission from Ben Gamari <bgamari at gmail.com>:
Even the simple example included below fails in the following manner,
$ sudo python3.1 hi.py
<class 'int'> 3
Traceback (most recent call last):
File "hi.py", line 13, in <module>
ioctl(a, EVIOCGID, buf, True)
TypeError: ioctl requires a file or file descriptor, an integer and optionally an integer or buffer argument
As the debugging output demonstrates, the fileno() is in fact a valid fd.
#!/usr/bin/python
from fcntl import ioctl
EVIOCGID = 1
f = open('/dev/input/mouse0', 'w')
buf = bytes([0]*128)
a = (f.fileno(),)
print(a.__class__, a)
ioctl(a, EVIOCGID, buf, True)
print(buf)
----------
components: Extension Modules
messages: 120657
nosy: bgamari
priority: normal
severity: normal
status: open
title: fcntl.ioctl always fails claiming an invalid fd
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10345>
_______________________________________
More information about the New-bugs-announce
mailing list