Skip to content

Commit 31f0236

Browse files
committed
Changes from review
1 parent 0427f01 commit 31f0236

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Modules/_ssl.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,7 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self)
11001100
}
11011101
Py_RETURN_NONE;
11021102
error:
1103+
assert(exc == NULL);
11031104
Py_XDECREF(sock);
11041105
return NULL;
11051106
}
@@ -2836,6 +2837,7 @@ _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b)
28362837
}
28372838
return PyLong_FromSize_t(count);
28382839
error:
2840+
assert(exc == NULL);
28392841
Py_XDECREF(sock);
28402842
return NULL;
28412843
}
@@ -2890,7 +2892,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
28902892
int retval;
28912893
int sockstate;
28922894
_PySSLError err;
2893-
PyObject *exc;
2895+
PyObject *exc = NULL;
28942896
int nonblocking;
28952897
PySocketSockObject *sock = GET_SOCKET(self);
28962898
PyTime_t timeout, deadline = 0;
@@ -2995,14 +2997,17 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
29952997

29962998
if (retval == 0) {
29972999
PySSL_SetError(self, err, exc, __FILE__, __LINE__);
3000+
exc = NULL;
29983001
goto error;
29993002
}
30003003
else if (exc != NULL) {
30013004
PyErr_SetRaisedException(exc);
3005+
exc = NULL;
30023006
goto error;
30033007
}
30043008

30053009
done:
3010+
assert(exc == NULL);
30063011
Py_XDECREF(sock);
30073012
if (!group_right_1) {
30083013
return PyBytesWriter_FinishWithSize(writer, count);
@@ -3012,6 +3017,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, Py_ssize_t len,
30123017
}
30133018

30143019
error:
3020+
assert(exc == NULL);
30153021
Py_XDECREF(sock);
30163022
if (!group_right_1) {
30173023
PyBytesWriter_Discard(writer);
@@ -3143,6 +3149,7 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self)
31433149
Py_RETURN_NONE;
31443150

31453151
error:
3152+
assert(exc == NULL);
31463153
Py_XDECREF(sock);
31473154
return NULL;
31483155
}

0 commit comments

Comments
 (0)