Skip to content

Commit 5cf26c9

Browse files
authored
python310/python311: fix failing tests with openssl >= 3.4 (#382794)
2 parents 83c5315 + 964b572 commit 5cf26c9

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
2+
index e637830..80728d2 100644
3+
--- a/Modules/_ssl.c
4+
+++ b/Modules/_ssl.c
5+
@@ -656,6 +656,11 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno)
6+
errstr = "Some I/O error occurred";
7+
}
8+
} else {
9+
+ if (ERR_GET_LIB(e) == ERR_LIB_SYS) {
10+
+ // A system error is being reported; reason is set to errno
11+
+ errno = ERR_GET_REASON(e);
12+
+ return PyErr_SetFromErrno(PyExc_OSError);
13+
+ }
14+
p = PY_SSL_ERROR_SYSCALL;
15+
}
16+
break;
17+
@@ -681,6 +686,11 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno)
18+
errstr = "EOF occurred in violation of protocol";
19+
}
20+
#endif
21+
+ if (ERR_GET_LIB(e) == ERR_LIB_SYS) {
22+
+ // A system error is being reported; reason is set to errno
23+
+ errno = ERR_GET_REASON(e);
24+
+ return PyErr_SetFromErrno(PyExc_OSError);
25+
+ }
26+
break;
27+
}
28+
default:

pkgs/development/interpreters/python/cpython/default.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,15 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
299299
] ++ optionals (pythonOlder "3.12") [
300300
# https://github.com/python/cpython/issues/90656
301301
./loongarch-support.patch
302+
# fix failing tests with openssl >= 3.4
303+
# https://github.com/python/cpython/pull/127361
304+
] ++ optionals (pythonAtLeast "3.10" && pythonOlder "3.11") [
305+
./3.10/raise-OSError-for-ERR_LIB_SYS.patch
306+
] ++ optionals (pythonAtLeast "3.11" && pythonOlder "3.12") [
307+
(fetchpatch {
308+
url = "https://github.com/python/cpython/commit/f4b31edf2d9d72878dab1f66a36913b5bcc848ec.patch";
309+
sha256 = "sha256-w7zZMp0yqyi4h5oG8sK4z9BwNEkqg4Ar+en3nlWcxh0=";
310+
})
302311
] ++ optionals (pythonAtLeast "3.11" && pythonOlder "3.13") [
303312
# backport fix for https://github.com/python/cpython/issues/95855
304313
./platform-triplet-detection.patch

0 commit comments

Comments
 (0)