Author DragonSA
Recipients DragonSA
Date 2011-05-01.18:26:33
SpamBayes Score 2.28368e-07
Marked as misclassified No
Message-id <1304274394.46.0.0260368215252.issue11973@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-05-01 18:26:34DragonSAsetrecipients: + DragonSA
2011-05-01 18:26:34DragonSAsetmessageid: <1304274394.46.0.0260368215252.issue11973@psf.upfronthosting.co.za>
2011-05-01 18:26:33DragonSAlinkissue11973 messages
2011-05-01 18:26:33DragonSAcreate