Commit Graph

77 Commits

Author SHA1 Message Date
Neal Norwitz 1fa040ba73 SF #1015517, get readline to compile with older compilers 2004-08-25 01:20:18 +00:00
Martin v. Löwis 701abe745b Fail fatally if strdup fails. 2004-08-20 06:26:59 +00:00
Martin v. Löwis 78a8acc55b Patch #914291: Restore locale while readline is running. 2004-08-18 13:34:00 +00:00
Skip Montanaro 6c06cd5ff9 fix a couple problems with the last patch picked up by Michael Hudson 2004-08-16 16:15:13 +00:00
Skip Montanaro e5069019e7 Add get_history_item and replace_history_item functions to the readline
module.  Closes patch #675551.  My apologies to Michal Vitecek for taking so
long to process this.
2004-08-15 14:32:06 +00:00
Michael W. Hudson 2384990603 PyThreadState_Swap(NULL) didn't do what I thought it did. Fixes
[ 987287 ] Python 2.4a1, interpreter hanging on Keyboard Interrupt
2004-07-08 15:28:26 +00:00
Michael W. Hudson 30ea2f223f This closes patch:
[ 960406 ] unblock signals in threads

although the changes do not correspond exactly to any patch attached to
that report.

Non-main threads no longer have all signals masked.

A different interface to readline is used.

The handling of signals inside calls to PyOS_Readline is now rather
different.

These changes are all a bit scary!  Review and cross-platform testing
much appreciated.
2004-07-07 17:44:12 +00:00
Skip Montanaro 79cddc56b3 stupid, stupid, stupid... raw_input() already supports readline() if the
readline module is loaded.
2004-05-24 14:20:16 +00:00
Skip Montanaro 0dc23101a0 Exposed readline() function from the readline module. 2004-05-23 17:46:50 +00:00
Nicholas Bastin 2786d90617 A few more PyThreadState_Get to PyThreadState_GET conversions 2004-03-25 02:16:23 +00:00
Skip Montanaro 7befb9966e remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
Martin v. Löwis f56d015a71 Patch #804543: strdup saved locales. Backported to 2.3. 2003-11-13 07:43:21 +00:00
Martin v. Löwis e7a9796a0f Patch #800697: Add readline.clear_history. 2003-09-20 16:08:33 +00:00
Michael W. Hudson afd43b5512 Remove inaccurate (and it turns out, entirely superfluous) declarations of
PyOS_InputHook and PyOS_ReadlineFunctionPointer).

The inaccuracies were causing problems in framework builds on Mac OS X.
2003-07-17 16:26:58 +00:00
Neal Norwitz 21d896cfa1 Use appropriate macros not the deprecated DL_IMPORT/DL_EXPORT macros 2003-07-01 20:15:21 +00:00
Neal Norwitz d9efdc5b5a get_completer() takes no args 2003-03-01 15:19:41 +00:00
Neal Norwitz c355f0cae9 flex_complete looks like a private (but callback) function, so make it static 2003-02-21 00:30:18 +00:00
Michael W. Hudson 0e986a312f I was in this module anyway, so I did some janitorial things.
METH_NOARGS functions are still called with two arguments, one NULL,
so put that back into the function definitions (I didn't know this
until recently).

Make get_history_length() METH_NOARGS.
2003-01-30 14:17:16 +00:00
Michael W. Hudson 796df156cd Add the get_completer() function based on Michael Stone's patch in
[ 676342 ] after using pdb readline does not work correctly

which is required to fix that bug.  So maaybe a bugfix candidate.
2003-01-30 10:12:51 +00:00
Guido van Rossum 6d0d3655af Fix from Michael Stone for SF bug #660476 and #513033 (bogus thread
state swaps in readline).
2003-01-07 20:34:19 +00:00
Guido van Rossum 05ac449d29 A few more whitespace normalizations. 2003-01-07 20:04:12 +00:00
Guido van Rossum 74f3143d18 Various cleanups:
- Whitespace normalization.

- Cleaned up some comments.

- Broke long lines.
2003-01-07 20:01:29 +00:00
Guido van Rossum faf5e4d48f Patch 659834 by Magnus Lie Hetland:
Check for readline 2.2 features.  This should make it possible to
compile readline.c again with GNU readline versions 2.0 or 2.1; this
ability was removed in readline.c rev. 2.49.  Apparently the older
versions are still in widespread deployment on older Solaris
installations.  With an older readline, completion behavior is subtly
different (a space is always added).
2002-12-30 16:25:41 +00:00
Martin v. Löwis 566f6afe9a Patch #512981: Update readline input stream on sys.stdin/out change. 2002-10-26 14:39:10 +00:00
Guido van Rossum 60c8a3aba8 GNU readline() mistakenly sets the LC_CTYPE locale.
This is evil.  Only the user or the app's main() should do this!
We must save and restore the locale around the rl_initialize() call.
2002-10-09 21:27:33 +00:00
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Skip Montanaro a039274ccc patch #562492 - prevent duplicate lines in history
also call using_history() to properly initialize history variables
2002-06-11 14:32:46 +00:00
Guido van Rossum 84271bb34f SF #558432: Prevent Annoying ' ' from readline (Holker Krekel).
readline in all python versions is configured
    to append a 'space' character for a successful
    completion. But for almost all python expressions
    'space' is not wanted (see coding conventions PEP 8).
    For example if you have a function 'longfunction'
    and you type 'longf<TAB>' you get 'longfunction '
    as a completion. note the unwanted space at the
    end.

    The patch fixes this behaviour by setting readline's
    append_character to '\0' which means don't append
    anything. This doesn't work with readline < 2.1
    (AFAIK nowadays readline2.2 is in good use).

    An alternative approach would be to make the
    append_character
    accessable from python so that modules like
    the rlcompleter.py can set it to '\0'.

[Ed.: I think expecting readline >= 2.2 is fine.  If a completer wants
another character they can append that to the keyword in the list.]
2002-05-30 15:41:56 +00:00
Neal Norwitz 0e0ee598fc #544265, Remove warnings for passing const to free() 2002-04-21 15:03:18 +00:00
Neal Norwitz 767f83539d Get rid of warnings due to changing to METH_NOARGS 2002-03-31 16:13:39 +00:00
Neal Norwitz 3a6f97850b Remove many uses of PyArg_NoArgs macro, change METH_OLDARGS to METH_NOARGS. 2002-03-25 20:46:46 +00:00
Neil Schemenauer 0f75e0dcad Add get_history_item, get_current_history_length, and redisplay functions.
Clarify the docstring for get_history_length.  Closes SF patch 494066.
2002-03-24 01:09:04 +00:00
Andrew MacIntyre 7bf6833e17 OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    _hotshot.c
    dbmmodule.c
    fcntlmodule.c
    main.c
    pwdmodule.c
    readline.c
    selectmodule.c
    signalmodule.c
    termios.c
    timemodule.c
    unicodedata.c
2002-03-03 02:59:16 +00:00
Michael W. Hudson 0c1ceaf66d Simon Budig's patch (posted by me):
[ #513235 ] prevent readline filename completion
2002-02-13 11:58:25 +00:00
Martin v. Löwis cdc4451222 Include <unistd.h> in Python.h. Fixes #500924. 2002-01-12 11:05:12 +00:00
Tim Peters 885d457709 sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the
former didn't make sense.
2001-11-28 20:27:42 +00:00
Marc-André Lemburg d4c0a9c59b Fixes for possible buffer overflows in sprintf() usages. 2001-11-28 11:47:00 +00:00
Guido van Rossum b6c1d5239c SF patch #443759: Add Interface to readline's add_history
This was submitted by Moshe, but apparently he's too busy to check it
in himself.  He wrote:

    Here is a function in GNU readline called add_history,
    which is used to manage the history list. Though Python
    uses this function internally, it does not expose it to
    the Python programmer. This patch adds direct interface
    to this function with documentation.

    This could be used by friendly modules to "seed" the
    history with commands.
2001-10-19 01:18:43 +00:00
Martin v. Löwis 0daad598d0 Patch #462122: add readline startup and pre_event hooks. 2001-09-30 21:09:59 +00:00
Fred Drake 52d55a3926 Cleaned up the docstring for readline.set_completer().
Thanks to Nathaniel Gray for reporting the confusion.
2001-08-01 21:44:14 +00:00
Guido van Rossum 353ae58964 SF Patch #432457 by Jason Tishler: support for readline 4.2.
This patch allows the readline module to build cleanly with GNU
readline 4.2 without breaking the build for earlier GNU readline
versions.  The configure script checks for the presence of
rl_completion_matches in libreadline.
2001-07-10 16:45:32 +00:00
Guido van Rossum b0e51b2957 Clean up the unsightly mess around the readline header files. We now
always:

- #undef HAVE_CONFIG_H (because otherwise chardefs.h tries to include
  strings.h)

- #include readline.h and history.h

and we never declare any readline function prototypes ourselves.

This makes it compile with readline 4.2, albeit with a few warnings.
Some of the remaining warnings are about completion_matches(), which
is renamed to rl_completion_matches().

I've tested it with various other versions, from 2.0 up, and they all
seem to work (some with warnings) -- but only on Red Hat Linux 6.2.

Fixing the warnings for readline 4.2 would break compatibility with
3.0 (and maybe even earlier versions), and readline doesn't seem to
have a way to test for its version at compile time, so I'd rather
leave the warnings in than break compilation with older versions.
2001-04-13 18:14:27 +00:00
Guido van Rossum 5a53019b0d Part of SF patch #102409 by jlt63 to support building these modules
under CYGWIN as shared libraries (DLLs).
2001-01-10 21:03:32 +00:00
Guido van Rossum 1ea64ea3ab Supporting rl_library_version is more trouble than it's worth --
readline doesn't have it before readline 2.2 and there's no
compile-time way to find out which readline version is in use.

Sigh.  GNU readline sucks.
2000-10-02 15:53:08 +00:00
Guido van Rossum 6c0f33f8ef Add a definition of rl_library_version. Reported by jpettit@sourceforge. 2000-09-20 20:24:21 +00:00
Guido van Rossum 174efc9cdb Use PyOS_setsig() instead of directly calling signal() or sigaction().
This fixes the first half of bug #110611: the immediate exit when ^C
is hit when readline and threads are configured.

Also added a new module variable, readline.library_version.
2000-09-16 16:37:53 +00:00
Guido van Rossum b9ce5ada37 Add three prototypes for functions in history.h to shut up gcc -Wall. 2000-09-01 02:43:38 +00:00
Fred Drake 8ce159aef5 Peter Schneider-Kamp <nowonder@nowonder.de>:
Remove some of GCC's warning in -Wstrict-prototypes mode.

This closes SourceForge patch #101342.
2000-08-31 05:18:54 +00:00
Moshe Zadka cf4d8ccb05 Removed unnecessary local variable -- gave warning on gcc -Wall 2000-08-04 22:31:42 +00:00