Commit b1a1a171 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Deal with the fact that EPOLLET can be negative in CPython

My theory is that this is because it overflows a signed int in
32-bit builds.  This should hopefully fix #272
parent 3089737c
......@@ -3,5 +3,18 @@ import select
for k in sorted(dir(select)):
if not k.startswith("EPOLL") and not k.startswith("POLL"):
continue
print k, getattr(select, k)
if k == "EPOLLET":
# On 32-bit versions of CPython, select.EPOLLET (==1<<31) overflows a 32-bit signed integer
# and becomes INT_MIN. But really, it's a bitmask so it's an unsigned value and imho should
# be provided as a positive number.
# Since we only build Pyston in 64-bit mode, EPOLLET is always positive in Pyston. If we
# see that it's negative, just make sure that it probably hit this behavior (wrapped around)
v = select.EPOLLET
if v < 0:
import sys
assert (-v) > sys.maxint
print abs(v)
else:
print k, getattr(select, k)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment