[issue11973] kevent does not accept KQ_NOTE_EXIT (and other (f)flags)
David Naylor
report at bugs.python.org
Sun May 1 20:26:34 CEST 2011
New submission from David Naylor <naylor.b.david at gmail.com>:
kevent does not accept all legitimate parameters, such as KQ_NOTE_EXIT.
For example:
>> from select import *
>> kevent(0, KQ_FILTER_PROC, KQ_EV_ADD | KQ_EV_ENABLE, KQ_NOTE_EXIT)
OverflowError: signed integer is greater than maximum
While the following C code compiles (under -Wall -pedantic) without error, or warning:
"""
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
int main(int argc, char **argv) {
struct kevent ke;
EV_SET(&ke, 0, EVFILT_PROC, EV_ADD | EV_ENABLE, NOTE_EXIT, 0, 0);
return (0);
}
"""
Looking at the Modules/selectmodule.c file it is clear that the fields "flags" and "fflags" are defined as T_USHORT and T_UINT however the flags passed to PyArg_ParseTupleAndKeywords are 'h' and 'i' respectively (implying signed numbers).
A workaround exists where values X > (2**31 - 1) are passed as (X - 2**32). Also the attached patch fixes the error.
----------
components: Extension Modules
files: patch-Modules-selectmodule.c
messages: 134918
nosy: DragonSA
priority: normal
severity: normal
status: open
title: kevent does not accept KQ_NOTE_EXIT (and other (f)flags)
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file21847/patch-Modules-selectmodule.c
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11973>
_______________________________________
More information about the Python-bugs-list
mailing list