Issue 11973: kevent does not accept KQ_NOTE_EXIT (and other (f)flags) (original) (raw)

Created on 2011-05-01 18:26 by DragonSA, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (12)

msg134918 - (view)

Author: David Naylor (DragonSA) *

Date: 2011-05-01 18:26

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 > (231 - 1) are passed as (X - 232). Also the attached patch fixes the error.

msg196124 - (view)

Author: Christian Heimes (christian.heimes) * (Python committer)

Date: 2013-08-25 12:48

The patch looks good to me.

msg196127 - (view)

Author: Roundup Robot (python-dev) (Python triager)

Date: 2013-08-25 12:58

New changeset d5334d8907dc by Christian Heimes in branch '3.3': Issue #11973: Fix a problem in kevent. The flags and fflags fields are now http://hg.python.org/cpython/rev/d5334d8907dc

New changeset 8345fb616cbd by Christian Heimes in branch 'default': Issue #11973: Fix a problem in kevent. The flags and fflags fields are now http://hg.python.org/cpython/rev/8345fb616cbd

New changeset 8eac75276e5b by Christian Heimes in branch '2.7': Issue #11973: Fix a problem in kevent. The flags and fflags fields are now http://hg.python.org/cpython/rev/8eac75276e5b

msg196128 - (view)

Author: Christian Heimes (christian.heimes) * (Python committer)

Date: 2013-08-25 12:59

Does somebody want to write a test for the issue, too?

msg213039 - (view)

Author: David Naylor (DragonSA) *

Date: 2014-03-10 15:28

As requested, please find attached the unit tests that check flags' can handle a u_short and fflags' can handle a u_int.

msg213040 - (view)

Author: David Naylor (DragonSA) *

Date: 2014-03-10 15:28

As requested, please find attached the unit tests that check flags' can handle a u_short and fflags' can handle a u_int.

msg213041 - (view)

Author: David Naylor (DragonSA) *

Date: 2014-03-10 15:28

As requested, please find attached the unit tests that check flags' can handle a u_short and fflags' can handle a u_int.

msg213042 - (view)

Author: David Naylor (DragonSA) *

Date: 2014-03-10 15:28

As requested, please find attached the unit tests that check flags' can handle a u_short and fflags' can handle a u_int.

msg213043 - (view)

Author: David Naylor (DragonSA) *

Date: 2014-03-10 15:28

As requested, please find attached the unit tests that check flags' can handle a u_short and fflags' can handle a u_int.

msg213044 - (view)

Author: David Naylor (DragonSA) *

Date: 2014-03-10 15:28

As requested, please find attached the unit tests that check flags' can handle a u_short and fflags' can handle a u_int.

msg229176 - (view)

Author: Roundup Robot (python-dev) (Python triager)

Date: 2014-10-12 16:53

New changeset 35542a32cd54 by R David Murray in branch '3.4': #11973: add test for previously fixed kevent signed/unsigned bug. https://hg.python.org/cpython/rev/35542a32cd54

New changeset a028299c9bc2 by R David Murray in branch 'default': Merge: #11973: add test for previously fixed kevent signed/unsigned bug. https://hg.python.org/cpython/rev/a028299c9bc2

New changeset 38fe09772b4f by R David Murray in branch '2.7': #11973: add test for previously fixed kevent signed/unsigned bug. https://hg.python.org/cpython/rev/38fe09772b4f

msg229177 - (view)

Author: R. David Murray (r.david.murray) * (Python committer)

Date: 2014-10-12 16:55

Committed the test finally. Thanks, David.

History

Date

User

Action

Args

2022-04-11 14:57:16

admin

set

github: 56182

2014-10-12 16:55:04

r.david.murray

set

status: open -> closed

nosy: + r.david.murray
messages: +

stage: commit review -> resolved

2014-10-12 16:53:58

python-dev

set

messages: +

2014-03-10 15:28:45

DragonSA

set

files: + test_kqueue.py.diff

messages: +

2014-03-10 15:28:44

DragonSA

set

files: + test_kqueue.py.diff

messages: +

2014-03-10 15:28:44

DragonSA

set

files: + test_kqueue.py.diff

messages: +

2014-03-10 15:28:43

DragonSA

set

files: + test_kqueue.py.diff

messages: +

2014-03-10 15:28:43

DragonSA

set

files: + test_kqueue.py.diff

messages: +

2014-03-10 15:28:42

DragonSA

set

files: + test_kqueue.py.diff
keywords: + patch
messages: +

2013-08-25 12:59:41

christian.heimes

set

resolution: fixed
messages: +
stage: patch review -> commit review

2013-08-25 12:58:46

python-dev

set

nosy: + python-dev
messages: +

2013-08-25 12:48:32

christian.heimes

set

nosy: + christian.heimes

messages: +
versions: + Python 3.4, - Python 3.1, Python 3.2

2013-08-25 06:08:31

koobs

set

nosy: + koobs

2011-05-01 18:50:22

pitrou

set

nosy: + ronaldoussoren, ned.deily
stage: patch review

versions: - Python 2.6, Python 2.5, Python 3.4

2011-05-01 18:26:33

DragonSA

create