summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl/debughelpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_ssl/debughelpers.c')
-rw-r--r--Modules/_ssl/debughelpers.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_ssl/debughelpers.c b/Modules/_ssl/debughelpers.c
index a81f0aa..07e9ce7 100644
--- a/Modules/_ssl/debughelpers.c
+++ b/Modules/_ssl/debughelpers.c
@@ -15,7 +15,6 @@ _PySSL_msg_callback(int write_p, int version, int content_type,
PyGILState_STATE threadstate;
PyObject *res = NULL;
PySSLSocket *ssl_obj = NULL; /* ssl._SSLSocket, borrowed ref */
- PyObject *ssl_socket = NULL; /* ssl.SSLSocket or ssl.SSLObject */
int msg_type;
threadstate = PyGILState_Ensure();
@@ -27,13 +26,14 @@ _PySSL_msg_callback(int write_p, int version, int content_type,
return;
}
+ PyObject *ssl_socket; /* ssl.SSLSocket or ssl.SSLObject */
if (ssl_obj->owner)
- ssl_socket = PyWeakref_GetObject(ssl_obj->owner);
+ ssl_socket = _PyWeakref_GET_REF(ssl_obj->owner);
else if (ssl_obj->Socket)
- ssl_socket = PyWeakref_GetObject(ssl_obj->Socket);
+ ssl_socket = _PyWeakref_GET_REF(ssl_obj->Socket);
else
- ssl_socket = (PyObject *)ssl_obj;
- Py_INCREF(ssl_socket);
+ ssl_socket = (PyObject *)Py_NewRef(ssl_obj);
+ assert(ssl_socket != NULL); // _PyWeakref_GET_REF() can return NULL
/* assume that OpenSSL verifies all payload and buf len is of sufficient
length */