python3.10: fix build with newer libedit. (#10019)

Reference: https://github.com/python/cpython/pull/110239
This commit is contained in:
OscarL
2024-01-28 13:54:07 -03:00
committed by GitHub
parent a1ca405445
commit 1c4b106f6c
2 changed files with 120 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
From c1ee28b070c7e21abdc0775170e55cc6a2e9a1d6 Mon Sep 17 00:00:00 2001
From 598e5d2dfeb8e3d250d8b00194a824e12dcccb35 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 10 Apr 2014 16:03:33 +0000
Subject: initial Haiku patch
@@ -579,20 +579,20 @@ index a39610a..d928e3a 100644
return
--
2.37.3
2.42.1
From d61ffd50efa383b6f983a2453b8c4ace1dfd08a6 Mon Sep 17 00:00:00 2001
From 9ebccc4de6a9e09034e372b51fbc44bd48a26f64 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 16 Apr 2017 10:05:42 +0200
Subject: fix for negative errnos
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index ffe9170..d1aca2c 100644
index f1e3d64..255b76a 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1835,6 +1835,8 @@ class Popen:
@@ -1851,6 +1851,8 @@ class Popen:
SubprocessError)
if issubclass(child_exception_type, OSError) and hex_errno:
errno_num = int(hex_errno, 16)
@@ -617,10 +617,10 @@ index b852ad7..60d4a6e 100644
*--cur = Py_hexdigits[saved_errno % 16];
saved_errno /= 16;
--
2.37.3
2.42.1
From 6ea969a9e922cc0d4d13264b64f53bfcceab43ec Mon Sep 17 00:00:00 2001
From 977ed8c19438909b0385edeec5c48a12bcbe4102 Mon Sep 17 00:00:00 2001
From: Philippe Houdoin <philippe.houdoin@gmail.com>
Date: Wed, 24 May 2017 11:09:43 +0000
Subject: Implement CTypes's find_library for Haiku
@@ -701,10 +701,10 @@ index 0c2510e..2b4f04c 100644
print(cdll.LoadLibrary("libm.so"))
print(cdll.LoadLibrary("libcrypt.so"))
--
2.37.3
2.42.1
From 5884e1af85f794460b3fba171265d2e3afb96e6a Mon Sep 17 00:00:00 2001
From eef795641d2a68c943b9e5abf8e62a70ad101a3c Mon Sep 17 00:00:00 2001
From: Philipp Wolfer <phil@parolu.io>
Date: Mon, 23 Sep 2019 09:14:58 +0200
Subject: webbrowser: Support for default browsers on Haiku
@@ -727,10 +727,10 @@ index ec3cece..6a29d2a 100755
# Prefer X browsers if present
if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"):
--
2.37.3
2.42.1
From eca15b55454d2fc30bb9733d3b95d7216a20ff25 Mon Sep 17 00:00:00 2001
From 3e23ccf91881f202e4fc4717c5c349bdc533ef14 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 4 Oct 2019 22:02:35 +0200
Subject: since 3.8, don't reinit locks on fork.
@@ -750,10 +750,10 @@ index d1d4333..bfe60ca 100644
pass # no-op when os.register_at_fork does not exist.
else:
--
2.37.3
2.42.1
From ff1c07348e3b4569eaa8321e8ac7763b7fa031f2 Mon Sep 17 00:00:00 2001
From 4d3693962cbca9ec7b1119bcbc8dbd68c1f9f309 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 15 May 2020 15:20:57 +0200
Subject: handle errors returned by internal_connect()
@@ -783,17 +783,17 @@ index e104107..383ba52 100644
return PyLong_FromLong((long) res);
--
2.37.3
2.42.1
From ea618daa66006c1b7f4930a8d3c1139b96fad25e Mon Sep 17 00:00:00 2001
From 927a26f7c664ba17cf04eb2eb2b42612fa2444b2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 19 Oct 2020 18:03:09 +0200
Subject: ttyname_r can use MAXPATHLEN
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 62b81a1..c03eccb 100644
index c0421a9..ace1449 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3079,11 +3079,14 @@ static PyObject *
@@ -813,10 +813,10 @@ index 62b81a1..c03eccb 100644
if (buffer == NULL) {
return PyErr_NoMemory();
--
2.37.3
2.42.1
From 349971e923507132460ee7b13a8251c2116e4de2 Mon Sep 17 00:00:00 2001
From 848dd6f0cb1d55919fbe51242b90a6f975cac74b Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Fri, 21 Oct 2022 19:58:50 -0300
Subject: Lib/test: require the "largefile" usage flag for I/O heavy tests.
@@ -866,10 +866,10 @@ index 8f34c18..999063f 100644
'test requires %s bytes and a long time to run' % str(0x180000000))
f = open(TESTFN, 'w+b')
--
2.37.3
2.42.1
From 3cc5352c5a75cb321d73dfd4c07225a704707cc5 Mon Sep 17 00:00:00 2001
From 78e3c80c060fad784dba7b612cfe28cde4fe2c3e Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 7 Mar 2023 18:29:29 +0100
Subject: default schemes for Haiku
@@ -953,10 +953,10 @@ index 4f92119..919d883 100644
return {
'prefix': 'nt',
--
2.37.3
2.42.1
From 4e354c56ade406a1ed301399c5ba0ecaf1fdcff8 Mon Sep 17 00:00:00 2001
From 0c23a702cdbe778d4e439780d58c3135f4310a07 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Fri, 10 Mar 2023 20:15:14 -0300
Subject: syncronize both _getuserbase() copies on site.py and sysconfig.py.
@@ -982,5 +982,98 @@ index 919d883..c306d43 100644
_HAS_USER_BASE = (_getuserbase() is not None)
--
2.37.3
2.42.1
From f20581bcb04343ad9c3587c81cdb3fa4ab0be68b Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Sat, 27 Jan 2024 08:14:52 -0300
Subject: Apply gh-109191 from Python upstream.
Fixes build with newer versions of libedit.
Only needed for our 3.10, as it is already fixed upstream for 3.11+.
diff --git a/Modules/readline.c b/Modules/readline.c
index 1d50672..236b11c 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -438,7 +438,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module,
default completion display. */
rl_completion_display_matches_hook =
readlinestate_global->completion_display_matches_hook ?
-#if defined(_RL_FUNCTION_TYPEDEF)
+#if defined(HAVE_RL_COMPDISP_FUNC_T)
(rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
#else
(VFunction *)on_completion_display_matches_hook : 0;
diff --git a/configure b/configure
index 4b71c4e..d5c0e1c 100755
--- a/configure
+++ b/configure
@@ -16158,6 +16158,23 @@ if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
$as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h
+fi
+
+
+ # in readline as well as newer editline (April 2023)
+ ac_fn_c_check_type "$LINENO" "rl_compdisp_func_t" "ac_cv_type_rl_compdisp_func_t" "
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+
+"
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes; then :
+
+$as_echo "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
+
fi
fi
diff --git a/configure.ac b/configure.ac
index d8ce1f1..8ac83da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5078,6 +5078,20 @@ if test "$py_cv_lib_readline" = yes; then
AC_CHECK_LIB($LIBREADLINE, append_history,
AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
[Define if readline supports append_history]),,$READLINE_LIBS)
+
+ # in readline as well as newer editline (April 2023)
+ AC_CHECK_TYPE([rl_compdisp_func_t],
+ [AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1],
+ [Define if readline supports rl_compdisp_func_t])],
+ [],
+ [
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+ ])
fi
# End of readline checks: restore LIBS
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 57c84e5..6d4f5fc 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -866,6 +866,9 @@
/* Define if you can turn off readline's signal handling. */
#undef HAVE_RL_CATCH_SIGNAL
+/* Define if readline supports rl_compdisp_func_t */
+#undef HAVE_RL_COMPDISP_FUNC_T
+
/* Define if you have readline 2.2 */
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
--
2.42.1