Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2adc6c

Browse files
committed
Use PySocket_Err() instead of PyErr_SetFromErrno().
The former does the right thing on Windows, the latter does not.
1 parent ba69936 commit e2adc6c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Modules/socketmodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
850850
strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name));
851851
ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0';
852852
if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) {
853-
PyErr_SetFromErrno(PySocket_Error);
853+
PySocket_Err();
854854
return 0;
855855
}
856856
addr = &(s->sock_addr.ll);
@@ -2530,8 +2530,7 @@ PySSL_SetError(SSL *ssl, int ret)
25302530
/* the underlying BIO reported an I/O error */
25312531
Py_DECREF(v);
25322532
Py_DECREF(n);
2533-
PyErr_SetFromErrno(PyExc_IOError);
2534-
return NULL;
2533+
return PySocket_Err();
25352534
} else {
25362535
/* XXX Protected by global interpreter lock */
25372536
errstr = ERR_error_string(e, NULL);

0 commit comments

Comments
 (0)