New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with kqueue #76074
Comments
In Modules/selectmodule.c it is assumed that the kevent structure is defined on FreeBSD and NetBSD as: struct kevent {
uintptr_t ident;
short filter;
u_short flags;
u_int fflags;
intptr_t data;
uintptr_t udata;
}; and on OpenBSD as: struct kevent {
u_int ident;
short filter;
u_short flags;
u_int fflags;
intptr_t data;
int udata;
}; Actually it is defined on FreeBSD as: struct kevent {
uintptr_t ident;
short filter;
u_short flags;
u_int fflags;
intptr_t data;
void *udata;
}; On OpenBSD as: struct kevent {
uintptr_t ident;
short filter;
u_short flags;
u_int fflags;
int64_t data;
void *udata;
}; And on NetBSD as: struct kevent {
uintptr_t ident;
uint32_t filter;
uint32_t flags;
uint32_t fflags;
int64_t data;
intptr_t udata;
}; Other issues are related to rich comparison. Due to integer overflows the ordering is not transitive. The rich comparison protocol is not properly supported, comparing a kevent_event object with a non-kevent_event object don't falls back to the rich comparison methods of the right arguments. |
The commit b9052a0 broke compilation on FreeBSD: building 'select' extension http://buildbot.python.org/all/#/builders/87/builds/95/steps/3/logs/stdio |
Oh, the commit also broke the "x86 Tiger 3.x buildbot: http://buildbot.python.org/all/#/builders/30/builds/93 ====================================================================== Traceback (most recent call last):
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_kqueue.py", line 71, in test_create_event
self.assertEqual(ev.data, 5)
AssertionError: 25769803781 != 5 |
Oh, I forgot that Mac OS X also in the BSD family. Thank you Victor for signaling errors. |
Tests on all buildbots are passed. |
Test fails on x86 Tiger 2.7: http://buildbot.python.org/all/#/builders/59/builds/17 ====================================================================== Traceback (most recent call last):
File "/Users/db3l/buildarea/2.7.bolen-tiger/build/Lib/test/test_kqueue.py", line 39, in test_create_event
self.assertRaises(TypeError, cmp, ev, None)
AssertionError: TypeError not raised |
Same failure on x86-64 El Capitan 2.7/ ====================================================================== Traceback (most recent call last):
File "/Users/buildbot/buildarea/2.7.billenstein-elcapitan/build/Lib/test/test_kqueue.py", line 39, in test_create_event
self.assertRaises(TypeError, cmp, ev, None)
AssertionError: TypeError not raised |
On also AMD64 FreeBSD 10.x Shared 2.7: http://buildbot.python.org/all/#/builders/97/builds/17 ====================================================================== Traceback (most recent call last):
File "/usr/home/buildbot/python/2.7.koobs-freebsd10/build/Lib/test/test_kqueue.py", line 39, in test_create_event
self.assertRaises(TypeError, cmp, ev, None)
AssertionError: TypeError not raised |
Oh, I didn't test on 2.7. The old code contradicted the common comparison behavior. It allowed comparing select.kevent with other objects only for equality as for identity. The new code uses the default behavior. There are two ways to fix this:
|
kqueue_event_richcompare() returns NotImplemented if other is not an event: if (!kqueue_event_Check(o)) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
} So I don't understand why tests started to fail with the commit ce51890. |
Because the default behavior is different in Python 2 and Python 3. In Python 3 this is a TypeError. In Python 2 all objects are comparable by default. |
I suggest to fix the tests, the code looks good to me. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: