[Python-Dev] Pervasive socket failures on Windows (original) (raw)

Tim Peters tim.peters at gmail.com
Fri Feb 10 22:49:09 CET 2006


[Tim]

I suggest skipping the new crud conditionalized on a symbol like

PySOCKETFDCANBEGEFDSETSIZE

[Martin]

Hmm... How about this patch:

I don't know. Of course it misses similar new tests added to _ssl.c (see the msg that started this thread), so it spreads beyond just this. Does it do the right thing for Windows variants like Cygwin, and OS/2? Don't know. If the initial

#ifdef MS_WINDOWS

here gets duplicated in multiple modules (and looks like it must -- or IS_SELECTABLE should be given a _Py name and defined once in pyport.h instead), and gets hairier over time, then I'd rather have a name like the one I suggested (to describe the intent rather than paste together a growing collection of "which platform do I think I'm being compiled on?" names).

Index: Modules/socketmodule.c =================================================================== --- Modules/socketmodule.c (Revision 42308) +++ Modules/socketmodule.c (Arbeitskopie) @@ -396,7 +396,14 @@ static PyTypeObject socktype;

/* Can we call select() with this socket without a buffer overrun? */ +#ifdef MSWINDOWS +/* Everything is selectable on Windows */ +#define ISSELECTABLE(s) 1 +#else +/* POSIX says selecting descriptors above FDSETSIZE is undefined + behaviour. */ #define ISSELECTABLE(s) ((s)->sockfd < FDSETSIZE) +#endif static PyObject* selecterror(void)



More information about the Python-Dev mailing list