Michael Haubenwallner added the comment:

This is a regression since 2.7.4 because of http://bugs.python.org/issue15989.

As the 'events' and 'revents' members of 'struct pollfd' both are bitfields, 
the question actually is why they need to be signed at all.

Additionally: I'm wondering why poll_modify() and internal_devpoll_register() 
haven't been updated along issue#15989, as both still have 'i' for the 'events' 
arg.

Attached patch (for hg-tip) changes the 'events' for 'struct pollfd' to be 
generally treated as unsigned short bitfield.

Not that I know of one, but the &0xffff hack may break on platforms where 
'short' is not 16bits - casting to (unsigned short) instead feels more save.

Additional question: Would it make sense to have the 'BHIkK' types check for 
overflow?

Thank you!

----------
nosy: +haubi
Added file: 
http://bugs.python.org/file32585/python-tip-unsigned-pollfd-events.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17919>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to