[Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.141.2.3,1.141.2.4

Anthony Baxter anthonybaxter@users.sourceforge.net
Thu, 01 Nov 2001 06:00:13 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv31353

Modified Files:
      Tag: release21-maint
	socketmodule.c 
Log Message:
backport tim's 1.191:
  PySocketSock_connect_ex():  On Windows, return the correct Windows exit
  code.  The patch is from Jeremy, and allows test_asynchat to run again.



Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.141.2.3
retrieving revision 1.141.2.4
diff -C2 -d -r1.141.2.3 -r1.141.2.4
*** socketmodule.c	2001/11/01 13:58:16	1.141.2.3
--- socketmodule.c	2001/11/01 14:00:11	1.141.2.4
***************
*** 1109,1114 ****
  	res = connect(s->sock_fd, addr, addrlen);
  	Py_END_ALLOW_THREADS
! 	if (res != 0)
  		res = errno;
  	return PyInt_FromLong((long) res);
  }
--- 1109,1119 ----
  	res = connect(s->sock_fd, addr, addrlen);
  	Py_END_ALLOW_THREADS
! 	if (res != 0) {
! #ifdef MS_WINDOWS
! 		res = WSAGetLastError();
! #else
  		res = errno;
+ #endif
+ 	}
  	return PyInt_FromLong((long) res);
  }