Commit Graph

105 Commits

Author SHA1 Message Date
R. David Murray 7a697251c9 Merged revisions 87356 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87356 | r.david.murray | 2010-12-17 22:48:32 -0500 (Fri, 17 Dec 2010) | 11 lines

  #9907: call rl_initialize early when using editline on OSX

  editline rl_initialize apparently discards any mappings done before it
  is called, which makes tab revert to file completion instead of inserting
  a tab.  So now on OSX we call rl_initialize first if we are using
  readline, and then re-read the users .editrc (if any) afterward so they
  can still override our defaults.

  Patch by Ned Deily, modified by Ronald Oussoren.
........
2010-12-18 03:52:09 +00:00
Mark Dickinson 0f98128d6e Merged revisions 83670 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83670 | mark.dickinson | 2010-08-03 17:49:49 +0100 (Tue, 03 Aug 2010) | 3 lines

  Issue #8065:  Fix another memory leak in readline module, from failure to free
  the result of a call to history_get_history_state.
........
2010-08-03 16:54:19 +00:00
Mark Dickinson 4ee9853028 Merged revisions 83667 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83667 | mark.dickinson | 2010-08-03 17:08:16 +0100 (Tue, 03 Aug 2010) | 2 lines

  Issue #9450:  Fix memory leaks in readline.remove/replace_history_entry.
........
2010-08-03 16:18:39 +00:00
Antoine Pitrou c83ea137d7 Untabify C files. Will watch buildbots. 2010-05-09 14:46:46 +00:00
Brett Cannon 23b581a6f4 Strip out extraneous whitespace, cast a some `const char *` to `void *` when
passed to free() and make a `char *` to a `const char *` as found by Clang's
static analyzer.
2010-05-04 00:52:41 +00:00
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