Commit Graph

142 Commits

Author SHA1 Message Date
Victor Stinner 92639cce35 Issue #19884, readline: calling rl_variable_bind ("enable-meta-key", "off")
does crash on Mac OS X which uses libedit instead of readline.
2014-07-24 22:11:38 +02:00
Victor Stinner a3c80ce8b7 Issue #19884: readline: Disable the meta modifier key if stdout is not a
terminal to not write the ANSI sequence "\033[1034h" into stdout. This sequence
is used on some terminal (ex: TERM=xterm-256color") to enable support of 8 bit
characters.
2014-07-24 12:23:56 +02:00
Serhiy Storchaka dfe98a102e Issue #20437: Fixed 22 potential bugs when deleting objects references. 2014-02-09 13:46:20 +02:00
Serhiy Storchaka 505ff755d7 Issue #20437: Fixed 21 potential bugs when deleting objects references. 2014-02-09 13:33:53 +02:00
Ned Deily 93db29b5c1 Issue #20374: merge 2014-02-05 17:03:42 -08:00
Ned Deily 22d415cf19 Issue #20374: delete spurious empty line 2014-02-05 17:02:29 -08:00
Ned Deily 4b104abdc9 Issue #20374: merge 2014-02-05 16:55:20 -08:00
Ned Deily 7b9ddea80b Issue #20374: Avoid compiler warnings when compiling readline with libedit. 2014-02-05 16:53:10 -08:00
Benjamin Peterson c3bf14d1eb merge 3.3 (#20374) 2014-01-24 11:44:40 -05:00
Benjamin Peterson f0b463ad84 new plan: just remove typecasts (closes #20374) 2014-01-24 11:44:16 -05:00
Benjamin Peterson 8f81c3cf3f merge 3.3 (#20374) 2014-01-24 00:33:25 -05:00
Benjamin Peterson 5f6bf55965 use new readline function types (closes #20374) 2014-01-24 00:32:12 -05:00
Christian Heimes a3da7c5f8a make char* const
readline() takes a const char* and the other readline_until_enter_or_signal() implementation
already has const char*.
2013-12-04 09:31:47 +01:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
Ned Deily 9809ca9d9e Issue #18458: merge comments from 3.3 2013-10-12 15:57:04 -07:00
Ned Deily 5d4121a631 Issue #18458: Prevent crashes with newer versions of libedit. Its readline
emulation has changed from 0-based indexing to 1-based like gnu readline.
Original patch by Ronald Oussoren.
2013-10-12 15:47:58 -07:00
Victor Stinner 2fe9bac4dc Close #16742: Fix misuse of memory allocations in PyOS_Readline()
The GIL must be held to call PyMem_Malloc(), whereas PyOS_Readline() releases
the GIL to read input.

The result of the C callback PyOS_ReadlineFunctionPointer must now be a string
allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL if an error
occurred), instead of a string allocated by PyMem_Malloc() or PyMem_Realloc().

Fixing this issue was required to setup a hook on PyMem_Malloc(), for example
using the tracemalloc module.

PyOS_Readline() copies the result of PyOS_ReadlineFunctionPointer() into a new
buffer allocated by PyMem_Malloc(). So the public API of PyOS_Readline() does
not change.
2013-10-10 16:18:20 +02:00
Ned Deily f70f4a63b6 Issue #18458: Prevent crashes with newer versions of libedit. Its readline
emulation has changed from 0-based indexing to 1-based like gnu readline.
Original patch by Ronald Oussoren.
2013-09-06 15:16:19 -07:00
Antoine Pitrou 5c30a75722 Issue #15699: The readline module now uses PEP 3121-style module initialization, so as to reclaim allocated resources (Python callbacks) at shutdown.
Original patch by Robin Schreiber.
2013-07-31 21:52:53 +02:00
Victor Stinner b64049183c Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules
Replace malloc() with PyMem_Malloc() when the GIL is held, or with
PyMem_RawMalloc() otherwise.
2013-07-07 16:21:41 +02:00
Antoine Pitrou 9b5d4d8cef Issue #17289: The readline module now plays nicer with external modules or applications changing the rl_completer_word_break_characters global variable.
Initial patch by Bradley Froehle.
2013-05-06 21:54:07 +02:00
Antoine Pitrou a7f7deb6ed Issue #17289: The readline module now plays nicer with external modules or applications changing the rl_completer_word_break_characters global variable.
Initial patch by Bradley Froehle.
2013-05-06 21:51:03 +02:00
Nadeem Vawda 56265564ff Back out fix for issue #13886; it introduced a new bug in interactive readline use. 2013-02-02 20:29:39 +01:00
Nadeem Vawda c27bcbf863 Back out fix for issue #13886; it introduced a new bug in interactive readline use. 2013-02-02 20:25:19 +01:00
Nadeem Vawda 6375257188 Back out fix for issue #13886; it introduced a new bug in interactive readline use. 2013-02-02 20:05:11 +01:00
Nadeem Vawda ef0a44c629 Issue #13886: Fix input() to not strip out supposedly-invalid input bytes.
Also fix sporadic failures in test_builtin due to dependence on whether the
readline module has previously been imported.
2013-01-27 14:17:21 +01:00
Nadeem Vawda 60cc32382f Issue #13886: Fix input() to not strip out supposedly-invalid input bytes.
Also fix sporadic failures in test_builtin due to dependence on whether the
readline module has previously been imported.
2013-01-27 14:13:25 +01:00
Nadeem Vawda 6f02ea02c8 Issue #13886: Fix input() to not strip out supposedly-invalid input bytes.
Also fix sporadic failures in test_builtin due to dependence on whether the
readline module has previously been imported.
2013-01-27 14:01:42 +01:00
Jesus Cea 14c81aba50 #16135: Removal of OS/2 support (Modules/*) 2012-10-05 02:11:36 +02:00
Antoine Pitrou ab0e9f7089 Issue #10350: Read and save errno before calling a function which might overwrite it.
Original patch by Hallvard B Furuseth.
2011-12-16 12:29:37 +01:00
Antoine Pitrou c345ce1a69 Issue #10350: Read and save errno before calling a function which might overwrite it.
Original patch by Hallvard B Furuseth.
2011-12-16 12:28:32 +01:00
Victor Stinner 6ced7c4333 Issue #10833: Use PyErr_Format() and PyUnicode_FromFormat() instead of
PyOS_snprintf() to avoid temporary buffer allocated on the stack and a
conversion from bytes to Unicode.
2011-03-21 18:15:42 +01:00
R. David Murray 52d1b4e62f #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:48:32 +00:00
Senthil Kumaran 95c0700eff Fix Issue 10307 - compile error in readline.c 2010-11-04 03:51:05 +00:00
Georg Brandl 646fdd6c61 Fix compiler warning about unused static function. 2010-10-18 07:27:55 +00:00
Brett Cannon 2525dc8fb6 Under OS X, history_get from readline returns a const char *, but the local
variable the return value is assigned to is char *. Since the assigned-to
variable is never changed, simply make that a const char * and cast all calls
to get_history to const char * to silence the compiler warning (found with
LLVM).
2010-08-22 20:36:25 +00:00
Mark Dickinson 6b54e1f782 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:49:49 +00:00
Mark Dickinson 29b238e0dc Issue #9450: Fix memory leaks in readline.remove/replace_history_entry. 2010-08-03 16:08:16 +00:00
Victor Stinner 19e65a3563 readline: use PyUnicode_FSConverter() to parse filenames 2010-06-11 22:27:14 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Ronald Oussoren 25696bb9b2 Merged revisions 78148 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78148 | ronald.oussoren | 2010-02-11 14:13:08 +0100 (Thu, 11 Feb 2010) | 3 lines

  Add guard around the prototype for completion_matches to enable
  compilition with libedit on OSX 10.5
........
2010-02-11 13:15:00 +00:00
Antoine Pitrou d51317709b Merged revisions 75725 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75725 | antoine.pitrou | 2009-10-26 20:16:46 +0100 (lun., 26 oct. 2009) | 4 lines

  Some platforms have rl_completion_append_character but not rl_completion_suppress_append.
  Reported by Mark D.
........
2009-10-26 19:22:14 +00:00
Antoine Pitrou dc0900b525 Merged revisions 75531-75532 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75531 | antoine.pitrou | 2009-10-19 20:17:18 +0200 (lun., 19 oct. 2009) | 4 lines

  Issue #5833: Fix extra space character in readline completion with the
  GNU readline library version 6.0.
........
  r75532 | antoine.pitrou | 2009-10-19 20:20:21 +0200 (lun., 19 oct. 2009) | 3 lines

  NEWS entry for r75531.
........
2009-10-19 18:22:37 +00:00
Ronald Oussoren 2efd924754 Merged revisions 74970 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74970 | ronald.oussoren | 2009-09-20 16:18:15 +0200 (Sun, 20 Sep 2009) | 7 lines

  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:53:22 +00:00
Matthias Klose 091c7b16ff Merged revisions 71229,71271 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71229 | matthias.klose | 2009-04-05 14:43:08 +0200 (So, 05 Apr 2009) | 3 lines

  - Py_DECREF: Add `do { ... } while (0)' to avoid compiler warnings.
    (avoiding brown paper typo this time)
........
  r71271 | matthias.klose | 2009-04-05 23:19:13 +0200 (So, 05 Apr 2009) | 3 lines

  Issue #1113244: Py_XINCREF, Py_DECREF, Py_XDECREF: Add `do { ... } while (0)'
  to avoid compiler warnings.
........
2009-04-07 13:24:27 +00:00
Martin v. Löwis b37509b11b Merged revisions 67098 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67098 | martin.v.loewis | 2008-11-04 21:40:09 +0100 (Di, 04 Nov 2008) | 2 lines

  Issue #4204: Fixed module build errors on FreeBSD 4.
........
2008-11-04 20:45:29 +00:00
Marc-André Lemburg 4cc0f24857 Rename PyUnicode_AsString -> _PyUnicode_AsString and
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark
them for interpreter internal use only.

We'll have to rework these APIs or create new ones for the
purpose of accessing the UTF-8 representation of Unicode objects
for 3.1.
2008-08-07 18:54:33 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00
Christian Heimes 217cfd1c86 Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h 2007-12-02 14:31:20 +00:00
Guido van Rossum 3d392eb327 Merged revisions 58947-59004 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r58952 | christian.heimes | 2007-11-12 10:58:08 -0800 (Mon, 12 Nov 2007) | 6 lines

  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?
........
  r58956 | guido.van.rossum | 2007-11-12 12:06:40 -0800 (Mon, 12 Nov 2007) | 2 lines

  Add the test from issue 1704621 (the issue itself is already fixed here).
........
  r58963 | amaury.forgeotdarc | 2007-11-13 13:54:28 -0800 (Tue, 13 Nov 2007) | 23 lines

  Merge from py3k branch:
  Correction for issue1265 (pdb bug with "with" statement).

  When an unfinished generator-iterator is garbage collected, PyEval_EvalFrameEx
  is called with a GeneratorExit exception set.  This leads to funny results
  if the sys.settrace function itself makes use of generators.
  A visible effect is that the settrace function is reset to None.
  Another is that the eventual "finally" block of the generator is not called.

  It is necessary to save/restore the exception around the call to the trace
  function.

  This happens a lot with py3k: isinstance() of an ABCMeta instance runs
      def __instancecheck__(cls, instance):
          """Override for isinstance(instance, cls)."""
          return any(cls.__subclasscheck__(c)
                     for c in {instance.__class__, type(instance)})
  which lets an opened generator expression each time it returns True.

  Backport candidate, even if the case is less frequent in 2.5.
........
  r58968 | georg.brandl | 2007-11-14 05:59:09 -0800 (Wed, 14 Nov 2007) | 2 lines

  Remove dead link from random docs.
........
  r58971 | raymond.hettinger | 2007-11-14 14:56:16 -0800 (Wed, 14 Nov 2007) | 1 line

  Make __fields__ read-only.  Suggested by Issac Morland
........
  r58972 | raymond.hettinger | 2007-11-14 15:02:30 -0800 (Wed, 14 Nov 2007) | 1 line

  Add test for __fields__ being read-only
........
  r58975 | raymond.hettinger | 2007-11-14 18:44:53 -0800 (Wed, 14 Nov 2007) | 6 lines

  Accept Issac Morland's suggestion for __replace__ to allow multiple replacements
  (suprisingly, this simplifies the signature, improves clarity, and is comparably fast).
  Update the docs to reflect a previous change to the function name.
  Add an example to the docs showing how to override the default __repr__ method.
........
  r58976 | raymond.hettinger | 2007-11-14 18:55:42 -0800 (Wed, 14 Nov 2007) | 1 line

  Small improvement to the implementation of __replace__().
........
  r58977 | raymond.hettinger | 2007-11-14 18:58:20 -0800 (Wed, 14 Nov 2007) | 1 line

  Fixup example in docs.
........
  r58978 | raymond.hettinger | 2007-11-14 19:16:09 -0800 (Wed, 14 Nov 2007) | 1 line

  Example of multiple replacements.
........
  r58998 | raymond.hettinger | 2007-11-15 14:39:34 -0800 (Thu, 15 Nov 2007) | 1 line

  Add example for use cases requiring default values.
........
  r59000 | bill.janssen | 2007-11-15 15:03:03 -0800 (Thu, 15 Nov 2007) | 1 line

  add the certificate for the Python SVN repository for testing SSL
........
  r59004 | guido.van.rossum | 2007-11-15 16:24:44 -0800 (Thu, 15 Nov 2007) | 8 lines

  A patch from issue 1378 by roudkerk:

  Currently on Windows set_error() make use of a large array which maps
  socket error numbers to error messages.

  This patch removes that array and just lets PyErr_SetExcFromWindowsErr()
  generate the message by using the Win32 function FormatMessage().
........
2007-11-16 00:35:22 +00:00