Python linked against OpenSSL 3.5 or later uses OpenSSL’s default group list, which starts with the hybrid group X25519MLKEM768, so it is default; with an earlier OpenSSL it is classical.
From Python 3.15, SSLContext.set_groups() lets the program choose groups, so classical groups can be disabled by the author; before 3.15 the ssl module has no such method for clients.1
The standard library has no public-key signing API of its own.
The Python project has published no commitment about post-quantum support (checked 2026-12-05).
On Python 3.15 or later, call ctx.set_groups("X25519MLKEM768") to allow only the hybrid group.1
Cryptographic operations
TLS connections (client or server, ssl.SSLContext): from 3.15, set_groups(groups) will “set the groups allowed for key agreement for sockets created with this context. It should be a string in the OpenSSL group list format.” SSLSocket.group() returns “the group used for doing key agreement on this connection”.1
SSLContext.set_ecdh_curve() takes one curve name; “this setting doesn’t apply to client sockets”.1
With no groups set, OpenSSL’s default list applies.
Versions
Change
Version
Package URL
Source
SSLContext.set_groups(), get_groups() and SSLSocket.group() added
Servers without the group fail the handshake. Before 3.15 there is no way to set a client’s group list; whether a build reads OpenSSL’s configuration file is unverified (checked 2026-12-05).