Library
-------
+- Issue #27773: Correct some memory management errors server_hostname in _ssl.wrap_socket().
+
- Issue #26750: unittest.mock.create_autospec() now works properly for
subclasses of property() and other data descriptors.
{
PySSLSocket *self;
SSL_CTX *ctx = sslctx->ctx;
- PyObject *hostname;
long mode;
self = PyObject_New(PySSLSocket, &PySSLSocket_Type);
self->shutdown_seen_zero = 0;
self->handshake_done = 0;
self->owner = NULL;
+ self->server_hostname = NULL;
if (server_hostname != NULL) {
- hostname = PyUnicode_Decode(server_hostname, strlen(server_hostname),
- "idna", "strict");
+ PyObject *hostname = PyUnicode_Decode(server_hostname, strlen(server_hostname),
+ "idna", "strict");
if (hostname == NULL) {
Py_DECREF(self);
return NULL;
}
self->server_hostname = hostname;
- } else
- self->server_hostname = NULL;
+ }
Py_INCREF(sslctx);
self->Socket = PyWeakref_NewRef((PyObject *) sock, NULL);
if (self->Socket == NULL) {
Py_DECREF(self);
- Py_XDECREF(self->server_hostname);
return NULL;
}
}