[PATCH stable] setup_py: support Python 3.15 with OpenSSL 4.0 without TLSv1.2 support

Mads Kiilerich mads at kiilerich.com
Tue Jun 30 19:25:14 UTC 2026


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1782843901 -7200
#      Tue Jun 30 20:25:01 2026 +0200
# Branch stable
# Node ID 292a9313129c241a20012329853fe7657d342b06
# Parent  9b96e7a25b0d3311f1f91d8acf4da0e3ce7e806d
setup_py: support Python 3.15 with OpenSSL 4.0 without TLSv1.2 support

On Fedora 45 with OpenSSL 4.0 and Python 3.15 with
https://github.com/python/cpython/commit/3364e7e62fa24d0e19133fb0f90b1c24ef1110c5
setup.py finds that ssl.HAS_TLSv1_2 no longer is True, and installation thus
fails.

sslutil.py has been checking ssl.HAS_TLSv1_3 for a long time, and that property
has been around as long as HAS_TLSv1_2. Let's accept that one in setup.py too.

Next step could be a cleanup for supported Python versions and let sslutil
access the HAS_X attributes directly and drop the PROTOCOL_TLSvX attributes
completely. That should be safe for all supported Python versions.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -12,9 +12,9 @@ import sys
 import sysconfig
 import tempfile
 
-if not ssl.HAS_TLSv1_2:
+if not ssl.HAS_TLSv1_2 and not ssl.HAS_TLSv1_3:
     error = """
-The `ssl` module does not advertise support for TLS 1.2.
+The `ssl` module does not advertise support for TLS 1.2 or later.
 Please make sure that your Python installation was compiled against an OpenSSL
 version enabling these features (likely this requires the OpenSSL version to
 be at least 1.0.1).



More information about the Mercurial-devel mailing list