Merge 3.5 (INVALID_SOCKET)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index f8d39f6..d21d18f 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2579,8 +2579,8 @@
int res;
fd = s->sock_fd;
- if (fd != -1) {
- s->sock_fd = -1;
+ if (fd != INVALID_SOCKET) {
+ s->sock_fd = INVALID_SOCKET;
/* We do not want to retry upon EINTR: see
http://lwn.net/Articles/576478/ and
@@ -2606,7 +2606,7 @@
sock_detach(PySocketSockObject *s)
{
SOCKET_T fd = s->sock_fd;
- s->sock_fd = -1;
+ s->sock_fd = INVALID_SOCKET;
return PyLong_FromSocket_t(fd);
}
@@ -4202,7 +4202,7 @@
/* Save the current exception, if any. */
PyErr_Fetch(&error_type, &error_value, &error_traceback);
- if (s->sock_fd != -1) {
+ if (s->sock_fd != INVALID_SOCKET) {
if (PyErr_ResourceWarning((PyObject *)s, 1, "unclosed %R", s)) {
/* Spurious errors can appear at shutdown */
if (PyErr_ExceptionMatches(PyExc_Warning)) {
@@ -4215,7 +4215,7 @@
socket.getsockname(). If the socket is closed before, socket
methods fails with the EBADF error. */
fd = s->sock_fd;
- s->sock_fd = -1;
+ s->sock_fd = INVALID_SOCKET;
/* We do not want to retry upon EINTR: see sock_close() */
Py_BEGIN_ALLOW_THREADS
@@ -4275,7 +4275,7 @@
new = type->tp_alloc(type, 0);
if (new != NULL) {
- ((PySocketSockObject *)new)->sock_fd = -1;
+ ((PySocketSockObject *)new)->sock_fd = INVALID_SOCKET;
((PySocketSockObject *)new)->sock_timeout = _PyTime_FromSeconds(-1);
((PySocketSockObject *)new)->errorhandler = &set_error;
}