Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 810aa6d commit d1e22baCopy full SHA for d1e22ba
5 files changed
Lib/test/test_readline.py
@@ -43,6 +43,8 @@ def testHistoryUpdates(self):
43
44
self.assertEqual(readline.get_current_history_length(), 1)
45
46
+ @unittest.skipUnless(hasattr(readline, "append_history"),
47
+ "append_history not available")
48
def test_write_read_append(self):
49
hfile = tempfile.NamedTemporaryFile(delete=False)
50
hfile.close()
Modules/readline.c
@@ -237,6 +237,7 @@ Save a readline history file.\n\
237
The default filename is ~/.history.");
238
239
240
+#ifdef HAVE_RL_APPEND_HISTORY
241
/* Exported function to save part of a readline history file */
242
243
static PyObject *
@@ -270,6 +271,7 @@ PyDoc_STRVAR(doc_append_history_file,
270
271
"append_history_file(nelements[, filename]) -> None\n\
272
Append the last nelements of the history list to file.\n\
273
274
+#endif
275
276
277
/* Set history length */
@@ -782,7 +784,9 @@ static struct PyMethodDef readline_methods[] =
782
784
METH_VARARGS, doc_read_history_file},
783
785
{"write_history_file", write_history_file,
786
METH_VARARGS, doc_write_history_file},
787
788
{"append_history_file", append_history_file,
789
790
METH_VARARGS, doc_append_history_file},
791
{"get_history_item", get_history_item,
792
METH_VARARGS, doc_get_history_item},
configure
@@ -14529,6 +14529,49 @@ rm -f conftest*
14529
14530
fi
14531
14532
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -lreadline" >&5
14533
+$as_echo_n "checking for append_history in -lreadline... " >&6; }
14534
+if ${ac_cv_lib_readline_append_history+:} false; then :
14535
+ $as_echo_n "(cached) " >&6
14536
+else
14537
+ ac_check_lib_save_LIBS=$LIBS
14538
+LIBS="-lreadline $READLINE_LIBS $LIBS"
14539
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14540
+/* end confdefs.h. */
14541
+
14542
+/* Override any GCC internal prototype to avoid an error.
14543
+ Use char because int might match the return type of a GCC
14544
+ builtin and then its argument prototype would still apply. */
14545
+#ifdef __cplusplus
14546
+extern "C"
14547
14548
+char append_history ();
14549
+int
14550
+main ()
14551
+{
14552
+return append_history ();
14553
+ ;
14554
+ return 0;
14555
+}
14556
+_ACEOF
14557
+if ac_fn_c_try_link "$LINENO"; then :
14558
+ ac_cv_lib_readline_append_history=yes
14559
14560
+ ac_cv_lib_readline_append_history=no
14561
+fi
14562
+rm -f core conftest.err conftest.$ac_objext \
14563
+ conftest$ac_exeext conftest.$ac_ext
14564
+LIBS=$ac_check_lib_save_LIBS
14565
14566
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_append_history" >&5
14567
+$as_echo "$ac_cv_lib_readline_append_history" >&6; }
14568
+if test "x$ac_cv_lib_readline_append_history" = xyes; then :
14569
14570
+$as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h
14571
14572
14573
14574
14575
# End of readline checks: restore LIBS
14576
LIBS=$LIBS_no_readline
14577
configure.ac
@@ -4308,6 +4308,10 @@ then
4308
[Define if you can turn off readline's signal handling.]), )
4309
4310
4311
+AC_CHECK_LIB(readline, append_history,
4312
+ AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
4313
+ [Define if readline supports append_history]), ,$READLINE_LIBS)
4314
4315
4316
4317
pyconfig.h.in
@@ -690,6 +690,9 @@
690
/* Define to 1 if you have the `renameat' function. */
691
#undef HAVE_RENAMEAT
692
693
+/* Define if readline supports append_history */
694
+#undef HAVE_RL_APPEND_HISTORY
695
696
/* Define if you have readline 2.1 */
697
#undef HAVE_RL_CALLBACK
698
0 commit comments