File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,9 +215,14 @@ select_select(self, args)
215215 PyObject * self ;
216216 PyObject * args ;
217217{
218+ #ifdef MS_WINDOWS
219+ /* This would be an awful lot of stack space on Windows! */
220+ pylist * rfd2obj , * wfd2obj , * efd2obj ;
221+ #else
218222 pylist rfd2obj [FD_SETSIZE + 3 ];
219223 pylist wfd2obj [FD_SETSIZE + 3 ];
220224 pylist efd2obj [FD_SETSIZE + 3 ];
225+ #endif
221226 PyObject * ifdlist , * ofdlist , * efdlist ;
222227 PyObject * ret = NULL ;
223228 PyObject * tout = Py_None ;
@@ -258,6 +263,18 @@ select_select(self, args)
258263 return NULL ;
259264 }
260265
266+ #ifdef MS_WINDOWS
267+ /* Allocate memory for the lists */
268+ rfd2obj = PyMem_NEW (pylist , FD_SETSIZE + 3 );
269+ wfd2obj = PyMem_NEW (pylist , FD_SETSIZE + 3 );
270+ efd2obj = PyMem_NEW (pylist , FD_SETSIZE + 3 );
271+ if (rfd2obj == NULL || wfd2obj == NULL || efd2obj == NULL ) {
272+ PyMem_XDEL (rfd2obj );
273+ PyMem_XDEL (wfd2obj );
274+ PyMem_XDEL (efd2obj );
275+ return NULL ;
276+ }
277+ #endif
261278 /* Convert lists to fd_sets, and get maximum fd number
262279 * propagates the Python exception set in list2set()
263280 */
@@ -311,6 +328,11 @@ select_select(self, args)
311328 reap_obj (rfd2obj );
312329 reap_obj (wfd2obj );
313330 reap_obj (efd2obj );
331+ #ifdef MS_WINDOWS
332+ PyMem_DEL (rfd2obj );
333+ PyMem_DEL (wfd2obj );
334+ PyMem_DEL (efd2obj );
335+ #endif
314336 return ret ;
315337}
316338
You can’t perform that action at this time.
0 commit comments