Commit Graph

100 Commits

Author SHA1 Message Date
Ronald Oussoren 333fca9b3e Add guard around the prototype for completion_matches to enable
compilition with libedit on OSX 10.5
2010-02-11 13:13:08 +00:00
Antoine Pitrou d9ff74e51d Some platforms have rl_completion_append_character but not rl_completion_suppress_append.
Reported by Mark D.
2009-10-26 19:16:46 +00:00
Antoine Pitrou 119cdef9b4 Issue #5833: Fix extra space character in readline completion with the
GNU readline library version 6.0.
2009-10-19 18:17:18 +00:00
Ronald Oussoren 9f20d9d0ee Issue 6877: this patch makes it possible to link the readline extension
to the libedit emulation of the readline API on OSX 10.5 or later.

This also adds a minimal testsuite for readline to check that the
history manipuation functions have the same interface with both
C libraries.
2009-09-20 14:18:15 +00:00
Matthias Klose 91a3b9e4f0 Issue #1113244: Py_XINCREF, Py_DECREF, Py_XDECREF: Add `do { ... } while (0)'
to avoid compiler warnings.
2009-04-05 21:19:13 +00:00
Martin v. Löwis bb86d83134 Issue #4204: Fixed module build errors on FreeBSD 4. 2008-11-04 20:40:09 +00:00
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Christian Heimes 1bc4af4bdd readline module cleanup
fixed indention to tabs
use Py_RETURN_NONE macro
added more error checks to on_completion_display_matches_hook

open question: Does PyList_SetItem(l, i, o) steal a reference to o in the case of an error?
2007-11-12 18:58:08 +00:00
Martin v. Löwis f354894e7b Only set rl_completion_display_matches_hook if there
is a Python hook function. Fixes #1425.
2007-11-12 04:53:02 +00:00
Martin v. Löwis 58bd49f5fe Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
2007-09-04 13:13:14 +00:00
Neal Norwitz bd53870d89 SF #1703270, add missing declaration in readline.c to avoid compiler warning. 2007-04-19 05:52:37 +00:00
Andrew M. Kuchling 62e475b84f [Bug #1552726] Avoid repeatedly polling in interactive mode -- only put a timeout on the select()
if an input hook has been defined.  Patch by Richard Boulton.

This select() code is only executed with readline 2.1, or if
READLINE_CALLBACKS is defined.

Backport candidate for 2.5, 2.4, probably earlier versions too.
2006-09-07 13:59:38 +00:00
Neal Norwitz 5eaf772980 Fix memory leaks in some conditions.
Reported by Klocwork #152.
2006-07-16 02:15:27 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Georg Brandl e677adc43a Fix parse errors in readline module when compiling without threads. 2005-09-29 13:40:49 +00:00
Michael W. Hudson e3afc598bc In a threads-disabled build, typing Ctrl-C into a raw_input() crashed,
because (essentially) I didn't realise that PY_BEGIN/END_ALLOW_THREADS
actually expanded to nothing under a no-threads build, so if you somehow
NULLed out the threadstate (e.g. by calling PyThread_SaveThread) it would
stay NULLed when you return to Python.  Argh!

Backport candidate.
2005-04-07 10:11:19 +00:00
Michael W. Hudson da6242c844 Fixes for
[ 1166660 ] The readline module can cause python to segfault

It seems to me that the code I'm rewriting here attempted to call any
user-supplied hook functions using the thread state of the thread that
called the hook-setting function, as opposed to that of the thread
that is currently executing.  This doesn't work, in general.

Fix this by using the PyGILState API (It wouldn't be that hard to
define a dummy version of said API when #ifndef WITH_THREAD, would
it?).

Also, check the conversion to integer of the return value of a hook
function for errors (this problem was mentioned in the ipython bug
report linked to in the above bug).
2005-03-30 11:21:53 +00:00
Michael W. Hudson 9a8c3142e2 Be a bit more accurate. 2005-03-30 10:09:12 +00:00
Michael W. Hudson b47039f66b I don't think it's particularly accurate to say Guido is maintaining
this module any more.
2005-03-30 09:38:12 +00:00
Martin v. Löwis 9533e34024 Patch #1093585: raise a ValueError for negative history items in
remove_history and replace_history. Will backport to 2.4.
2005-02-27 20:33:25 +00:00
Hye-Shik Chang 7a8173a477 Rename a static variable "history_length" to "_history_length".
GNU readline exports a global variable that has such a name already
and the collision makes gcc4 doesn't compile the source.
2004-11-25 04:04:20 +00:00
Michael W. Hudson 8da2b01c3f This is Michiel de Hoon's patch, as attached to the bug report:
[ 1030629 ] PyOS_InputHook broken

with a couple of utterly inconsequential changes by me.
2004-10-07 13:46:33 +00:00
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