#endif /* Py_LIMITED_API */
/* A routine to check if a file descriptor can be select()-ed. */
-#ifdef HAVE_SELECT
- #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
+#ifdef _MSC_VER
+ /* On Windows, any socket fd can be select()-ed, no matter how high */
+ #define _PyIsSelectable_fd(FD) (1)
#else
- #define _PyIsSelectable_fd(FD) (1)
-#endif /* HAVE_SELECT */
+ #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
+#endif
#ifdef __cplusplus
}
--- /dev/null
+Remove obsolete code in readline module for platforms where GNU readline is
+older than 2.1 or where select() is not available.
/* Standard definitions */
#include "Python.h"
#include <stddef.h>
-#include <setjmp.h>
#include <signal.h>
#include <errno.h>
#include <sys/time.h>
/* Wrapper around GNU readline that handles signals differently. */
-
-#if defined(HAVE_RL_CALLBACK) && defined(HAVE_SELECT)
-
-static char *completed_input_string;
+static char *completed_input_string;
static void
rlhandler(char *text)
{
}
-#else
-
-/* Interrupt handler */
-
-static jmp_buf jbuf;
-
-/* ARGSUSED */
-static void
-onintr(int sig)
-{
- longjmp(jbuf, 1);
-}
-
-
-static char *
-readline_until_enter_or_signal(const char *prompt, int *signal)
-{
- PyOS_sighandler_t old_inthandler;
- char *p;
-
- *signal = 0;
-
- old_inthandler = PyOS_setsig(SIGINT, onintr);
- if (setjmp(jbuf)) {
-#ifdef HAVE_SIGRELSE
- /* This seems necessary on SunOS 4.1 (Rasmus Hahn) */
- sigrelse(SIGINT);
-#endif
- PyOS_setsig(SIGINT, old_inthandler);
- *signal = 1;
- return NULL;
- }
- rl_event_hook = PyOS_InputHook;
- p = readline(prompt);
- PyOS_setsig(SIGINT, old_inthandler);
-
- return p;
-}
-#endif /*defined(HAVE_RL_CALLBACK) && defined(HAVE_SELECT) */
-
-
static char *
call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
{
/* Define if you have readlink. */
/* #undef HAVE_READLINK */
-/* Define if you have select. */
-/* #undef HAVE_SELECT */
-
/* Define if you have setpgid. */
/* #undef HAVE_SETPGID */
fi
-# check for readline 2.1
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5
-$as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; }
-if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char rl_callback_handler_install ();
-int
-main ()
-{
-return rl_callback_handler_install ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_readline_rl_callback_handler_install=yes
-else
- ac_cv_lib_readline_rl_callback_handler_install=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5
-$as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; }
-if test "x$ac_cv_lib_readline_rl_callback_handler_install" = xyes; then :
-
-$as_echo "#define HAVE_RL_CALLBACK 1" >>confdefs.h
-
-fi
-
-
# check for readline 2.2
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
[Define if you have the readline library (-lreadline).])
fi
-# check for readline 2.1
-AC_CHECK_LIB(readline, rl_callback_handler_install,
- AC_DEFINE(HAVE_RL_CALLBACK, 1,
- [Define if you have readline 2.1]), ,$READLINE_LIBS)
-
# check for readline 2.2
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
[have_readline=yes],
/* Define if readline supports append_history */
#undef HAVE_RL_APPEND_HISTORY
-/* Define if you have readline 2.1 */
-#undef HAVE_RL_CALLBACK
-
/* Define if you can turn off readline's signal handling. */
#undef HAVE_RL_CATCH_SIGNAL
/* Define to 1 if you have the `sched_setscheduler' function. */
#undef HAVE_SCHED_SETSCHEDULER
-/* Define to 1 if you have the `select' function. */
-#undef HAVE_SELECT
-
/* Define to 1 if you have the `sem_getvalue' function. */
#undef HAVE_SEM_GETVALUE