← Back to DAGDA | Support | Source: https://github.com/python/cpython/commit/2134686587881df510f7992106fb2e6845fcb324
Skip to content

Commit 2134686

Browse files
committed
Add API to get the address of the SSL structure.
This allows an application which wants to call SSL_* functios via ctypes or ccfi to do that.
1 parent e694085 commit 2134686

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎Modules/_ssl.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,17 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
935935

936936
/* SSL object methods */
937937

938+
/*[clinic input]
939+
_ssl._SSLSocket.get_internal_addr
940+
[clinic start generated code]*/
941+
942+
static PyObject *
943+
_ssl__SSLSocket_get_internal_addr_impl(PySSLSocket *self)
944+
/*[clinic end generated code: output=1f4d2afe94d5cb67 input=48e3adf2ace2e50d]*/
945+
{
946+
return Py_BuildValue(_Py_PARSE_INTPTR, (intptr_t)self->ssl);
947+
}
948+
938949
/*[clinic input]
939950
_ssl._SSLSocket.do_handshake
940951
[clinic start generated code]*/
@@ -2977,6 +2988,7 @@ static PyGetSetDef ssl_getsetlist[] = {
29772988
};
29782989

29792990
static PyMethodDef PySSLMethods[] = {
2991+
_SSL__SSLSOCKET_GET_INTERNAL_ADDR_METHODDEF
29802992
_SSL__SSLSOCKET_DO_HANDSHAKE_METHODDEF
29812993
_SSL__SSLSOCKET_WRITE_METHODDEF
29822994
_SSL__SSLSOCKET_READ_METHODDEF

‎Modules/clinic/_ssl.c.h‎

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)