Tim Peters wrote: > The code in selectmodule when _MSC_VER is _not_ defined complains if a > socket fd is >= FD_SETSIZE _or_ is < 0. But the new code in > socketmodule on non-Windows boxes is happy with negative fds, saying > "fine" whenever fd < FD_SETSIZE. Is that right or wrong?
I think it is right: the code just "knows" that negative values cannot happen. The socket handles originate from system calls (socket(2), accept(2)), and a negative value returned there is an error. However, the system might (and did) return handles larger than FD_SETSIZE (as the kernel often won't know what value FD_SETSIZE has). > "The answer" isn't so important to me as that this kind of crap always > happens when platform-specific logic ends up getting defined in > multiple modules. Much better to define macros to hide this junk, > exactly once; pyport.h is the natural place for it. That must be done carefully, though. For example, how should the line max = 0; /* not used for Win32 */ be treated? Should we introduce a #define Py_SELECT_NUMBER_OF_FDS_PARAMETER_IS_IRRELEVANT? Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com