mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Merge 3.5 (INVALID_SOCKET)
This commit is contained in:
commit
d3afb62b8f
2 changed files with 12 additions and 8 deletions
|
@ -2579,8 +2579,8 @@ sock_close(PySocketSockObject *s)
|
|||
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 @@ static PyObject *
|
|||
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 @@ sock_finalize(PySocketSockObject *s)
|
|||
/* 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 @@ sock_finalize(PySocketSockObject *s)
|
|||
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 @@ sock_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue