[issue7211] select module - kevent ident field 64 bit issue
Antoine Pitrou
report at bugs.python.org
Thu Oct 29 14:29:43 CET 2009
Antoine Pitrou <pitrou at free.fr> added the comment:
According to man pages on the Web, the kevent structure is:
struct kevent {
uintptr_t ident; /* identifier for this event */
short filter; /* filter for event */
u_short flags; /* action flags for kqueue */
u_int fflags; /* filter flag value */
intptr_t data; /* filter data value */
void *udata; /* opaque user data identifier */
};
So the `ident` field is indeed an uintptr_t.
However the patch is slightly wrong IMO:
- you should not blindly use `long long`. Python already defines a
"Py_uintptr_t" type. If you need more information you should conditional
compilation such as in (for the off_t type)
http://svn.python.org/view/python/trunk/Modules/_io/_iomodule.h?view=markup
- in tests, you should use sys.maxsize (which gives you the max value of
a ssize_t integer) rather than choosing based on platform.architecture():
>>> sys.maxsize
9223372036854775807
>>> 2**64*1
18446744073709551616L
>>> sys.maxsize*2 + 1
18446744073709551615L
PS : a patch against trunk or py3k is preferred, but in this case it
would probably apply cleanly anyway
----------
nosy: +pitrou
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7211>
_______________________________________
More information about the Python-bugs-list
mailing list