2007-08-15 11:28:22 -03:00
|
|
|
:mod:`readline` --- GNU readline interface
|
|
|
|
==========================================
|
|
|
|
|
|
|
|
.. module:: readline
|
|
|
|
:platform: Unix
|
|
|
|
:synopsis: GNU readline support for Python.
|
2016-06-11 16:02:54 -03:00
|
|
|
|
2024-01-28 10:51:25 -04:00
|
|
|
.. sectionauthor:: Skip Montanaro <skip.montanaro@gmail.com>
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-06-11 16:02:54 -03:00
|
|
|
--------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
The :mod:`readline` module defines a number of functions to facilitate
|
|
|
|
completion and reading/writing of history files from the Python interpreter.
|
2016-04-05 04:37:22 -03:00
|
|
|
This module can be used directly, or via the :mod:`rlcompleter` module, which
|
|
|
|
supports completion of Python identifiers at the interactive prompt. Settings
|
2007-08-15 11:28:22 -03:00
|
|
|
made using this module affect the behaviour of both the interpreter's
|
2007-09-07 11:15:41 -03:00
|
|
|
interactive prompt and the prompts offered by the built-in :func:`input`
|
|
|
|
function.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-05-17 03:45:10 -03:00
|
|
|
Readline keybindings may be configured via an initialization file, typically
|
|
|
|
``.inputrc`` in your home directory. See `Readline Init File
|
2023-04-22 11:24:47 -03:00
|
|
|
<https://tiswww.cwru.edu/php/chet/readline/rluserman.html#Readline-Init-File>`_
|
2018-05-17 03:45:10 -03:00
|
|
|
in the GNU Readline manual for information about the format and
|
|
|
|
allowable constructs of that file, and the capabilities of the
|
|
|
|
Readline library in general.
|
|
|
|
|
2024-03-28 05:13:13 -03:00
|
|
|
.. include:: ../includes/wasm-ios-notavail.rst
|
|
|
|
|
2010-01-04 05:29:10 -04:00
|
|
|
.. note::
|
2009-09-20 11:53:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
The underlying Readline library API may be implemented by
|
2023-12-01 10:05:55 -04:00
|
|
|
the ``editline`` (``libedit``) library instead of GNU readline.
|
2018-05-17 03:45:10 -03:00
|
|
|
On macOS the :mod:`readline` module detects which library is being used
|
2016-04-05 04:37:22 -03:00
|
|
|
at run time.
|
2009-09-20 11:53:22 -03:00
|
|
|
|
2023-12-01 10:05:55 -04:00
|
|
|
The configuration file for ``editline`` is different from that
|
2010-09-21 11:48:28 -03:00
|
|
|
of GNU readline. If you programmatically load configuration strings
|
2023-12-01 10:05:55 -04:00
|
|
|
you can use :data:`backend` to determine which library is being used.
|
2009-09-20 11:53:22 -03:00
|
|
|
|
2023-12-01 10:05:55 -04:00
|
|
|
If you use ``editline``/``libedit`` readline emulation on macOS, the
|
2018-05-17 03:45:10 -03:00
|
|
|
initialization file located in your home directory is named
|
|
|
|
``.editrc``. For example, the following content in ``~/.editrc`` will
|
|
|
|
turn ON *vi* keybindings and TAB completion::
|
|
|
|
|
|
|
|
python:bind -v
|
|
|
|
python:bind ^I rl_complete
|
2016-06-09 21:27:46 -03:00
|
|
|
|
2023-12-01 10:05:55 -04:00
|
|
|
.. data:: backend
|
|
|
|
|
|
|
|
The name of the underlying Readline library being used, either
|
|
|
|
``"readline"`` or ``"editline"``.
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
2009-09-20 11:53:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Init file
|
|
|
|
---------
|
|
|
|
|
|
|
|
The following functions relate to the init file and user configuration:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: parse_and_bind(string)
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Execute the init line provided in the *string* argument. This calls
|
|
|
|
:c:func:`rl_parse_and_bind` in the underlying library.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: read_init_file([filename])
|
|
|
|
|
|
|
|
Execute a readline initialization file. The default filename is the last filename
|
|
|
|
used. This calls :c:func:`rl_read_init_file` in the underlying library.
|
|
|
|
|
|
|
|
|
|
|
|
Line buffer
|
|
|
|
-----------
|
|
|
|
|
|
|
|
The following functions operate on the line buffer:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: get_line_buffer()
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Return the current contents of the line buffer (:c:data:`rl_line_buffer`
|
|
|
|
in the underlying library).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: insert_text(string)
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Insert text into the line buffer at the cursor position. This calls
|
|
|
|
:c:func:`rl_insert_text` in the underlying library, but ignores
|
|
|
|
the return value.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
.. function:: redisplay()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Change what's displayed on the screen to reflect the current contents of the
|
|
|
|
line buffer. This calls :c:func:`rl_redisplay` in the underlying library.
|
|
|
|
|
|
|
|
|
|
|
|
History file
|
|
|
|
------------
|
|
|
|
|
|
|
|
The following functions operate on a history file:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: read_history_file([filename])
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Load a readline history file, and append it to the history list.
|
|
|
|
The default filename is :file:`~/.history`. This calls
|
|
|
|
:c:func:`read_history` in the underlying library.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: write_history_file([filename])
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Save the history list to a readline history file, overwriting any
|
|
|
|
existing file. The default filename is :file:`~/.history`. This calls
|
|
|
|
:c:func:`write_history` in the underlying library.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2014-11-26 15:58:16 -04:00
|
|
|
.. function:: append_history_file(nelements[, filename])
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Append the last *nelements* items of history to a file. The default filename is
|
|
|
|
:file:`~/.history`. The file must already exist. This calls
|
2016-06-14 05:45:43 -03:00
|
|
|
:c:func:`append_history` in the underlying library. This function
|
|
|
|
only exists if Python was compiled for a version of the library
|
|
|
|
that supports it.
|
2014-11-26 15:58:16 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.5
|
|
|
|
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
.. function:: get_history_length()
|
|
|
|
set_history_length(length)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Set or return the desired number of lines to save in the history file.
|
|
|
|
The :func:`write_history_file` function uses this value to truncate
|
|
|
|
the history file, by calling :c:func:`history_truncate_file` in
|
|
|
|
the underlying library. Negative values imply
|
|
|
|
unlimited history file size.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
History list
|
|
|
|
------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
The following functions operate on a global history list:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
.. function:: clear_history()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Clear the current history. This calls :c:func:`clear_history` in the
|
|
|
|
underlying library. The Python function only exists if Python was
|
|
|
|
compiled for a version of the library that supports it.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: get_current_history_length()
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Return the number of items currently in the history. (This is different from
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`get_history_length`, which returns the maximum number of lines that will
|
|
|
|
be written to a history file.)
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: get_history_item(index)
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Return the current contents of history item at *index*. The item index
|
|
|
|
is one-based. This calls :c:func:`history_get` in the underlying library.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: remove_history_item(pos)
|
|
|
|
|
|
|
|
Remove history item specified by its position from the history.
|
2016-04-05 04:37:22 -03:00
|
|
|
The position is zero-based. This calls :c:func:`remove_history` in
|
|
|
|
the underlying library.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: replace_history_item(pos, line)
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Replace history item specified by its position with *line*.
|
|
|
|
The position is zero-based. This calls :c:func:`replace_history_entry`
|
|
|
|
in the underlying library.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
.. function:: add_history(line)
|
|
|
|
|
|
|
|
Append *line* to the history buffer, as if it was the last line typed.
|
|
|
|
This calls :c:func:`add_history` in the underlying library.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
|
2016-05-14 22:26:25 -03:00
|
|
|
.. function:: set_auto_history(enabled)
|
|
|
|
|
|
|
|
Enable or disable automatic calls to :c:func:`add_history` when reading
|
|
|
|
input via readline. The *enabled* argument should be a Boolean value
|
2016-10-19 12:36:51 -03:00
|
|
|
that when true, enables auto history, and that when false, disables
|
2016-05-14 22:26:25 -03:00
|
|
|
auto history.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
|
|
|
|
.. impl-detail::
|
|
|
|
Auto history is enabled by default, and changes to this do not persist
|
|
|
|
across multiple sessions.
|
|
|
|
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Startup hooks
|
|
|
|
-------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: set_startup_hook([function])
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Set or remove the function invoked by the :c:data:`rl_startup_hook`
|
|
|
|
callback of the underlying library. If *function* is specified, it will
|
|
|
|
be used as the new hook function; if omitted or ``None``, any function
|
|
|
|
already installed is removed. The hook is called with no
|
2007-08-15 11:28:22 -03:00
|
|
|
arguments just before readline prints the first prompt.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: set_pre_input_hook([function])
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Set or remove the function invoked by the :c:data:`rl_pre_input_hook`
|
|
|
|
callback of the underlying library. If *function* is specified, it will
|
|
|
|
be used as the new hook function; if omitted or ``None``, any
|
|
|
|
function already installed is removed. The hook is called
|
2007-08-15 11:28:22 -03:00
|
|
|
with no arguments after the first prompt has been printed and just before
|
2016-06-14 05:45:43 -03:00
|
|
|
readline starts reading input characters. This function only exists
|
|
|
|
if Python was compiled for a version of the library that supports it.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2023-12-15 04:57:23 -04:00
|
|
|
.. _readline-completion:
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Completion
|
|
|
|
----------
|
|
|
|
|
|
|
|
The following functions relate to implementing a custom word completion
|
|
|
|
function. This is typically operated by the Tab key, and can suggest and
|
|
|
|
automatically complete a word being typed. By default, Readline is set up
|
|
|
|
to be used by :mod:`rlcompleter` to complete Python identifiers for
|
|
|
|
the interactive interpreter. If the :mod:`readline` module is to be used
|
|
|
|
with a custom completer, a different set of word delimiters should be set.
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: set_completer([function])
|
|
|
|
|
|
|
|
Set or remove the completer function. If *function* is specified, it will be
|
|
|
|
used as the new completer function; if omitted or ``None``, any completer
|
|
|
|
function already installed is removed. The completer function is called as
|
|
|
|
``function(text, state)``, for *state* in ``0``, ``1``, ``2``, ..., until it
|
|
|
|
returns a non-string value. It should return the next possible completion
|
|
|
|
starting with *text*.
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
The installed completer function is invoked by the *entry_func* callback
|
|
|
|
passed to :c:func:`rl_completion_matches` in the underlying library.
|
|
|
|
The *text* string comes from the first parameter to the
|
|
|
|
:c:data:`rl_attempted_completion_function` callback of the
|
|
|
|
underlying library.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. function:: get_completer()
|
|
|
|
|
|
|
|
Get the completer function, or ``None`` if no completer function has been set.
|
|
|
|
|
|
|
|
|
Merged revisions 57778-58052 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r57820 | georg.brandl | 2007-08-31 08:59:27 +0200 (Fri, 31 Aug 2007) | 2 lines
Document new shorthand notation for index entries.
........
r57827 | georg.brandl | 2007-08-31 10:47:51 +0200 (Fri, 31 Aug 2007) | 2 lines
Fix subitem markup.
........
r57833 | martin.v.loewis | 2007-08-31 12:01:07 +0200 (Fri, 31 Aug 2007) | 1 line
Mark registry components as 64-bit on Win64.
........
r57854 | bill.janssen | 2007-08-31 21:02:23 +0200 (Fri, 31 Aug 2007) | 1 line
deprecate use of FakeSocket
........
r57855 | bill.janssen | 2007-08-31 21:02:46 +0200 (Fri, 31 Aug 2007) | 1 line
remove mentions of socket.ssl in comments
........
r57856 | bill.janssen | 2007-08-31 21:03:31 +0200 (Fri, 31 Aug 2007) | 1 line
remove use of non-existent SSLFakeSocket in apparently untested code
........
r57859 | martin.v.loewis | 2007-09-01 08:36:03 +0200 (Sat, 01 Sep 2007) | 3 lines
Bug #1737210: Change Manufacturer of Windows installer to PSF.
Will backport to 2.5.
........
r57865 | georg.brandl | 2007-09-01 09:51:24 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix RST link (backport from Py3k).
........
r57876 | georg.brandl | 2007-09-01 17:49:49 +0200 (Sat, 01 Sep 2007) | 2 lines
Document sets' ">" and "<" operations (backport from py3k).
........
r57878 | skip.montanaro | 2007-09-01 19:40:03 +0200 (Sat, 01 Sep 2007) | 4 lines
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).
........
r57879 | walter.doerwald | 2007-09-01 20:18:09 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix wrong function names.
........
r57880 | walter.doerwald | 2007-09-01 20:34:05 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix typo.
........
r57889 | andrew.kuchling | 2007-09-01 22:31:59 +0200 (Sat, 01 Sep 2007) | 1 line
Markup fix
........
r57892 | andrew.kuchling | 2007-09-01 22:43:36 +0200 (Sat, 01 Sep 2007) | 1 line
Add various items
........
r57895 | andrew.kuchling | 2007-09-01 23:17:58 +0200 (Sat, 01 Sep 2007) | 1 line
Wording change
........
r57896 | andrew.kuchling | 2007-09-01 23:18:31 +0200 (Sat, 01 Sep 2007) | 1 line
Add more items
........
r57904 | ronald.oussoren | 2007-09-02 11:46:07 +0200 (Sun, 02 Sep 2007) | 3 lines
Macosx: this patch ensures that the value of MACOSX_DEPLOYMENT_TARGET used
by the Makefile is also used at configure-time.
........
r57925 | georg.brandl | 2007-09-03 09:16:46 +0200 (Mon, 03 Sep 2007) | 2 lines
Fix #883466: don't allow Unicode as arguments to quopri and uu codecs.
........
r57936 | matthias.klose | 2007-09-04 01:33:04 +0200 (Tue, 04 Sep 2007) | 2 lines
- Added support for linking the bsddb module against BerkeleyDB 4.6.x.
........
r57954 | mark.summerfield | 2007-09-04 10:16:15 +0200 (Tue, 04 Sep 2007) | 3 lines
Added cross-references plus a note about dict & list shallow copying.
........
r57958 | martin.v.loewis | 2007-09-04 11:51:57 +0200 (Tue, 04 Sep 2007) | 3 lines
Document that we rely on the OS to release the crypto
context. Fixes #1626801.
........
r57960 | martin.v.loewis | 2007-09-04 15:13:14 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
........
r57961 | martin.v.loewis | 2007-09-04 16:19:28 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1031213: Decode source line in SyntaxErrors back to its original
source encoding. Will backport to 2.5.
........
r57972 | matthias.klose | 2007-09-04 20:17:36 +0200 (Tue, 04 Sep 2007) | 3 lines
- Makefile.pre.in(buildbottest): Run an optional script pybuildbot.identify
to include some information about the build environment.
........
r57973 | matthias.klose | 2007-09-04 21:05:38 +0200 (Tue, 04 Sep 2007) | 2 lines
- Makefile.pre.in(buildbottest): Remove whitespace at eol.
........
r57975 | matthias.klose | 2007-09-04 22:46:02 +0200 (Tue, 04 Sep 2007) | 2 lines
- Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*.
........
r57980 | bill.janssen | 2007-09-05 02:46:27 +0200 (Wed, 05 Sep 2007) | 1 line
SSL certificate distinguished names should be represented by tuples
........
r57985 | martin.v.loewis | 2007-09-05 08:39:17 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #1105: Explain that one needs to build the solution
to get dependencies right.
........
r57987 | armin.rigo | 2007-09-05 09:51:21 +0200 (Wed, 05 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
There are probably a number of places that are open to attacks
such as the following one, in bltinmodule.c:min_max().
........
r57991 | martin.v.loewis | 2007-09-05 13:47:34 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
........
r57993 | georg.brandl | 2007-09-05 15:36:44 +0200 (Wed, 05 Sep 2007) | 2 lines
Backport from Py3k: Bug #1684991: explain lookup semantics for __special__ methods (new-style classes only).
........
r58004 | armin.rigo | 2007-09-06 10:30:51 +0200 (Thu, 06 Sep 2007) | 4 lines
Patch #1733973 by peaker:
ptrace_enter_call() assumes no exception is currently set.
This assumption is broken when throwing into a generator.
........
r58006 | armin.rigo | 2007-09-06 11:30:38 +0200 (Thu, 06 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
This attack is against ceval.c:IMPORT_NAME, which calls an
object (__builtin__.__import__) without holding a reference to it.
........
r58013 | georg.brandl | 2007-09-06 16:49:56 +0200 (Thu, 06 Sep 2007) | 2 lines
Backport from 3k: #1116: fix reference to old filename.
........
r58021 | thomas.heller | 2007-09-06 22:26:20 +0200 (Thu, 06 Sep 2007) | 1 line
Fix typo: c_float represents to C float type.
........
r58022 | skip.montanaro | 2007-09-07 00:29:06 +0200 (Fri, 07 Sep 2007) | 3 lines
If this is correct for py3k branch and it's already in the release25-maint
branch, seems like it ought to be on the trunk as well.
........
r58023 | gregory.p.smith | 2007-09-07 00:59:59 +0200 (Fri, 07 Sep 2007) | 4 lines
Apply the fix from Issue1112 to make this test more robust and keep
windows happy.
........
r58031 | brett.cannon | 2007-09-07 05:17:50 +0200 (Fri, 07 Sep 2007) | 4 lines
Make uuid1 and uuid4 tests conditional on whether ctypes can be imported;
implementation of either function depends on ctypes but uuid as a whole does
not.
........
r58032 | brett.cannon | 2007-09-07 06:18:30 +0200 (Fri, 07 Sep 2007) | 6 lines
Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call(). Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
........
r58034 | thomas.heller | 2007-09-07 08:32:17 +0200 (Fri, 07 Sep 2007) | 1 line
Add a 'c_longdouble' type to the ctypes module.
........
r58035 | thomas.heller | 2007-09-07 11:30:40 +0200 (Fri, 07 Sep 2007) | 1 line
Remove unneeded #include.
........
r58036 | thomas.heller | 2007-09-07 11:33:24 +0200 (Fri, 07 Sep 2007) | 6 lines
Backport from py3k branch:
Add a workaround for a strange bug on win64, when _ctypes is compiled
with the SDK compiler. This should fix the failing
Lib\ctypes\test\test_as_parameter.py test.
........
r58037 | georg.brandl | 2007-09-07 16:14:40 +0200 (Fri, 07 Sep 2007) | 2 lines
Fix a wrong indentation for sublists.
........
r58043 | georg.brandl | 2007-09-07 22:10:49 +0200 (Fri, 07 Sep 2007) | 2 lines
#1095: ln -f doesn't work portably, fix in Makefile.
........
r58049 | skip.montanaro | 2007-09-08 02:34:17 +0200 (Sat, 08 Sep 2007) | 1 line
be explicit about the actual location of the missing file
........
2007-09-08 14:39:28 -03:00
|
|
|
.. function:: get_completion_type()
|
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Get the type of completion being attempted. This returns the
|
|
|
|
:c:data:`rl_completion_type` variable in the underlying library as
|
|
|
|
an integer.
|
Merged revisions 57778-58052 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r57820 | georg.brandl | 2007-08-31 08:59:27 +0200 (Fri, 31 Aug 2007) | 2 lines
Document new shorthand notation for index entries.
........
r57827 | georg.brandl | 2007-08-31 10:47:51 +0200 (Fri, 31 Aug 2007) | 2 lines
Fix subitem markup.
........
r57833 | martin.v.loewis | 2007-08-31 12:01:07 +0200 (Fri, 31 Aug 2007) | 1 line
Mark registry components as 64-bit on Win64.
........
r57854 | bill.janssen | 2007-08-31 21:02:23 +0200 (Fri, 31 Aug 2007) | 1 line
deprecate use of FakeSocket
........
r57855 | bill.janssen | 2007-08-31 21:02:46 +0200 (Fri, 31 Aug 2007) | 1 line
remove mentions of socket.ssl in comments
........
r57856 | bill.janssen | 2007-08-31 21:03:31 +0200 (Fri, 31 Aug 2007) | 1 line
remove use of non-existent SSLFakeSocket in apparently untested code
........
r57859 | martin.v.loewis | 2007-09-01 08:36:03 +0200 (Sat, 01 Sep 2007) | 3 lines
Bug #1737210: Change Manufacturer of Windows installer to PSF.
Will backport to 2.5.
........
r57865 | georg.brandl | 2007-09-01 09:51:24 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix RST link (backport from Py3k).
........
r57876 | georg.brandl | 2007-09-01 17:49:49 +0200 (Sat, 01 Sep 2007) | 2 lines
Document sets' ">" and "<" operations (backport from py3k).
........
r57878 | skip.montanaro | 2007-09-01 19:40:03 +0200 (Sat, 01 Sep 2007) | 4 lines
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).
........
r57879 | walter.doerwald | 2007-09-01 20:18:09 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix wrong function names.
........
r57880 | walter.doerwald | 2007-09-01 20:34:05 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix typo.
........
r57889 | andrew.kuchling | 2007-09-01 22:31:59 +0200 (Sat, 01 Sep 2007) | 1 line
Markup fix
........
r57892 | andrew.kuchling | 2007-09-01 22:43:36 +0200 (Sat, 01 Sep 2007) | 1 line
Add various items
........
r57895 | andrew.kuchling | 2007-09-01 23:17:58 +0200 (Sat, 01 Sep 2007) | 1 line
Wording change
........
r57896 | andrew.kuchling | 2007-09-01 23:18:31 +0200 (Sat, 01 Sep 2007) | 1 line
Add more items
........
r57904 | ronald.oussoren | 2007-09-02 11:46:07 +0200 (Sun, 02 Sep 2007) | 3 lines
Macosx: this patch ensures that the value of MACOSX_DEPLOYMENT_TARGET used
by the Makefile is also used at configure-time.
........
r57925 | georg.brandl | 2007-09-03 09:16:46 +0200 (Mon, 03 Sep 2007) | 2 lines
Fix #883466: don't allow Unicode as arguments to quopri and uu codecs.
........
r57936 | matthias.klose | 2007-09-04 01:33:04 +0200 (Tue, 04 Sep 2007) | 2 lines
- Added support for linking the bsddb module against BerkeleyDB 4.6.x.
........
r57954 | mark.summerfield | 2007-09-04 10:16:15 +0200 (Tue, 04 Sep 2007) | 3 lines
Added cross-references plus a note about dict & list shallow copying.
........
r57958 | martin.v.loewis | 2007-09-04 11:51:57 +0200 (Tue, 04 Sep 2007) | 3 lines
Document that we rely on the OS to release the crypto
context. Fixes #1626801.
........
r57960 | martin.v.loewis | 2007-09-04 15:13:14 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
........
r57961 | martin.v.loewis | 2007-09-04 16:19:28 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1031213: Decode source line in SyntaxErrors back to its original
source encoding. Will backport to 2.5.
........
r57972 | matthias.klose | 2007-09-04 20:17:36 +0200 (Tue, 04 Sep 2007) | 3 lines
- Makefile.pre.in(buildbottest): Run an optional script pybuildbot.identify
to include some information about the build environment.
........
r57973 | matthias.klose | 2007-09-04 21:05:38 +0200 (Tue, 04 Sep 2007) | 2 lines
- Makefile.pre.in(buildbottest): Remove whitespace at eol.
........
r57975 | matthias.klose | 2007-09-04 22:46:02 +0200 (Tue, 04 Sep 2007) | 2 lines
- Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*.
........
r57980 | bill.janssen | 2007-09-05 02:46:27 +0200 (Wed, 05 Sep 2007) | 1 line
SSL certificate distinguished names should be represented by tuples
........
r57985 | martin.v.loewis | 2007-09-05 08:39:17 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #1105: Explain that one needs to build the solution
to get dependencies right.
........
r57987 | armin.rigo | 2007-09-05 09:51:21 +0200 (Wed, 05 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
There are probably a number of places that are open to attacks
such as the following one, in bltinmodule.c:min_max().
........
r57991 | martin.v.loewis | 2007-09-05 13:47:34 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
........
r57993 | georg.brandl | 2007-09-05 15:36:44 +0200 (Wed, 05 Sep 2007) | 2 lines
Backport from Py3k: Bug #1684991: explain lookup semantics for __special__ methods (new-style classes only).
........
r58004 | armin.rigo | 2007-09-06 10:30:51 +0200 (Thu, 06 Sep 2007) | 4 lines
Patch #1733973 by peaker:
ptrace_enter_call() assumes no exception is currently set.
This assumption is broken when throwing into a generator.
........
r58006 | armin.rigo | 2007-09-06 11:30:38 +0200 (Thu, 06 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
This attack is against ceval.c:IMPORT_NAME, which calls an
object (__builtin__.__import__) without holding a reference to it.
........
r58013 | georg.brandl | 2007-09-06 16:49:56 +0200 (Thu, 06 Sep 2007) | 2 lines
Backport from 3k: #1116: fix reference to old filename.
........
r58021 | thomas.heller | 2007-09-06 22:26:20 +0200 (Thu, 06 Sep 2007) | 1 line
Fix typo: c_float represents to C float type.
........
r58022 | skip.montanaro | 2007-09-07 00:29:06 +0200 (Fri, 07 Sep 2007) | 3 lines
If this is correct for py3k branch and it's already in the release25-maint
branch, seems like it ought to be on the trunk as well.
........
r58023 | gregory.p.smith | 2007-09-07 00:59:59 +0200 (Fri, 07 Sep 2007) | 4 lines
Apply the fix from Issue1112 to make this test more robust and keep
windows happy.
........
r58031 | brett.cannon | 2007-09-07 05:17:50 +0200 (Fri, 07 Sep 2007) | 4 lines
Make uuid1 and uuid4 tests conditional on whether ctypes can be imported;
implementation of either function depends on ctypes but uuid as a whole does
not.
........
r58032 | brett.cannon | 2007-09-07 06:18:30 +0200 (Fri, 07 Sep 2007) | 6 lines
Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call(). Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
........
r58034 | thomas.heller | 2007-09-07 08:32:17 +0200 (Fri, 07 Sep 2007) | 1 line
Add a 'c_longdouble' type to the ctypes module.
........
r58035 | thomas.heller | 2007-09-07 11:30:40 +0200 (Fri, 07 Sep 2007) | 1 line
Remove unneeded #include.
........
r58036 | thomas.heller | 2007-09-07 11:33:24 +0200 (Fri, 07 Sep 2007) | 6 lines
Backport from py3k branch:
Add a workaround for a strange bug on win64, when _ctypes is compiled
with the SDK compiler. This should fix the failing
Lib\ctypes\test\test_as_parameter.py test.
........
r58037 | georg.brandl | 2007-09-07 16:14:40 +0200 (Fri, 07 Sep 2007) | 2 lines
Fix a wrong indentation for sublists.
........
r58043 | georg.brandl | 2007-09-07 22:10:49 +0200 (Fri, 07 Sep 2007) | 2 lines
#1095: ln -f doesn't work portably, fix in Makefile.
........
r58049 | skip.montanaro | 2007-09-08 02:34:17 +0200 (Sat, 08 Sep 2007) | 1 line
be explicit about the actual location of the missing file
........
2007-09-08 14:39:28 -03:00
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. function:: get_begidx()
|
2016-04-05 04:37:22 -03:00
|
|
|
get_endidx()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Get the beginning or ending index of the completion scope.
|
|
|
|
These indexes are the *start* and *end* arguments passed to the
|
|
|
|
:c:data:`rl_attempted_completion_function` callback of the
|
2021-02-12 16:04:46 -04:00
|
|
|
underlying library. The values may be different in the same
|
2021-03-13 21:00:28 -04:00
|
|
|
input editing scenario based on the underlying C readline implementation.
|
2021-02-12 16:04:46 -04:00
|
|
|
Ex: libedit is known to behave differently than libreadline.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: set_completer_delims(string)
|
2016-04-05 04:37:22 -03:00
|
|
|
get_completer_delims()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-04-05 04:37:22 -03:00
|
|
|
Set or get the word delimiters for completion. These determine the
|
|
|
|
start of the word to be considered for completion (the completion scope).
|
|
|
|
These functions access the :c:data:`rl_completer_word_break_characters`
|
|
|
|
variable in the underlying library.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2007-12-02 19:15:43 -04:00
|
|
|
|
Merged revisions 57778-58052 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r57820 | georg.brandl | 2007-08-31 08:59:27 +0200 (Fri, 31 Aug 2007) | 2 lines
Document new shorthand notation for index entries.
........
r57827 | georg.brandl | 2007-08-31 10:47:51 +0200 (Fri, 31 Aug 2007) | 2 lines
Fix subitem markup.
........
r57833 | martin.v.loewis | 2007-08-31 12:01:07 +0200 (Fri, 31 Aug 2007) | 1 line
Mark registry components as 64-bit on Win64.
........
r57854 | bill.janssen | 2007-08-31 21:02:23 +0200 (Fri, 31 Aug 2007) | 1 line
deprecate use of FakeSocket
........
r57855 | bill.janssen | 2007-08-31 21:02:46 +0200 (Fri, 31 Aug 2007) | 1 line
remove mentions of socket.ssl in comments
........
r57856 | bill.janssen | 2007-08-31 21:03:31 +0200 (Fri, 31 Aug 2007) | 1 line
remove use of non-existent SSLFakeSocket in apparently untested code
........
r57859 | martin.v.loewis | 2007-09-01 08:36:03 +0200 (Sat, 01 Sep 2007) | 3 lines
Bug #1737210: Change Manufacturer of Windows installer to PSF.
Will backport to 2.5.
........
r57865 | georg.brandl | 2007-09-01 09:51:24 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix RST link (backport from Py3k).
........
r57876 | georg.brandl | 2007-09-01 17:49:49 +0200 (Sat, 01 Sep 2007) | 2 lines
Document sets' ">" and "<" operations (backport from py3k).
........
r57878 | skip.montanaro | 2007-09-01 19:40:03 +0200 (Sat, 01 Sep 2007) | 4 lines
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).
........
r57879 | walter.doerwald | 2007-09-01 20:18:09 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix wrong function names.
........
r57880 | walter.doerwald | 2007-09-01 20:34:05 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix typo.
........
r57889 | andrew.kuchling | 2007-09-01 22:31:59 +0200 (Sat, 01 Sep 2007) | 1 line
Markup fix
........
r57892 | andrew.kuchling | 2007-09-01 22:43:36 +0200 (Sat, 01 Sep 2007) | 1 line
Add various items
........
r57895 | andrew.kuchling | 2007-09-01 23:17:58 +0200 (Sat, 01 Sep 2007) | 1 line
Wording change
........
r57896 | andrew.kuchling | 2007-09-01 23:18:31 +0200 (Sat, 01 Sep 2007) | 1 line
Add more items
........
r57904 | ronald.oussoren | 2007-09-02 11:46:07 +0200 (Sun, 02 Sep 2007) | 3 lines
Macosx: this patch ensures that the value of MACOSX_DEPLOYMENT_TARGET used
by the Makefile is also used at configure-time.
........
r57925 | georg.brandl | 2007-09-03 09:16:46 +0200 (Mon, 03 Sep 2007) | 2 lines
Fix #883466: don't allow Unicode as arguments to quopri and uu codecs.
........
r57936 | matthias.klose | 2007-09-04 01:33:04 +0200 (Tue, 04 Sep 2007) | 2 lines
- Added support for linking the bsddb module against BerkeleyDB 4.6.x.
........
r57954 | mark.summerfield | 2007-09-04 10:16:15 +0200 (Tue, 04 Sep 2007) | 3 lines
Added cross-references plus a note about dict & list shallow copying.
........
r57958 | martin.v.loewis | 2007-09-04 11:51:57 +0200 (Tue, 04 Sep 2007) | 3 lines
Document that we rely on the OS to release the crypto
context. Fixes #1626801.
........
r57960 | martin.v.loewis | 2007-09-04 15:13:14 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
........
r57961 | martin.v.loewis | 2007-09-04 16:19:28 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1031213: Decode source line in SyntaxErrors back to its original
source encoding. Will backport to 2.5.
........
r57972 | matthias.klose | 2007-09-04 20:17:36 +0200 (Tue, 04 Sep 2007) | 3 lines
- Makefile.pre.in(buildbottest): Run an optional script pybuildbot.identify
to include some information about the build environment.
........
r57973 | matthias.klose | 2007-09-04 21:05:38 +0200 (Tue, 04 Sep 2007) | 2 lines
- Makefile.pre.in(buildbottest): Remove whitespace at eol.
........
r57975 | matthias.klose | 2007-09-04 22:46:02 +0200 (Tue, 04 Sep 2007) | 2 lines
- Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*.
........
r57980 | bill.janssen | 2007-09-05 02:46:27 +0200 (Wed, 05 Sep 2007) | 1 line
SSL certificate distinguished names should be represented by tuples
........
r57985 | martin.v.loewis | 2007-09-05 08:39:17 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #1105: Explain that one needs to build the solution
to get dependencies right.
........
r57987 | armin.rigo | 2007-09-05 09:51:21 +0200 (Wed, 05 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
There are probably a number of places that are open to attacks
such as the following one, in bltinmodule.c:min_max().
........
r57991 | martin.v.loewis | 2007-09-05 13:47:34 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
........
r57993 | georg.brandl | 2007-09-05 15:36:44 +0200 (Wed, 05 Sep 2007) | 2 lines
Backport from Py3k: Bug #1684991: explain lookup semantics for __special__ methods (new-style classes only).
........
r58004 | armin.rigo | 2007-09-06 10:30:51 +0200 (Thu, 06 Sep 2007) | 4 lines
Patch #1733973 by peaker:
ptrace_enter_call() assumes no exception is currently set.
This assumption is broken when throwing into a generator.
........
r58006 | armin.rigo | 2007-09-06 11:30:38 +0200 (Thu, 06 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
This attack is against ceval.c:IMPORT_NAME, which calls an
object (__builtin__.__import__) without holding a reference to it.
........
r58013 | georg.brandl | 2007-09-06 16:49:56 +0200 (Thu, 06 Sep 2007) | 2 lines
Backport from 3k: #1116: fix reference to old filename.
........
r58021 | thomas.heller | 2007-09-06 22:26:20 +0200 (Thu, 06 Sep 2007) | 1 line
Fix typo: c_float represents to C float type.
........
r58022 | skip.montanaro | 2007-09-07 00:29:06 +0200 (Fri, 07 Sep 2007) | 3 lines
If this is correct for py3k branch and it's already in the release25-maint
branch, seems like it ought to be on the trunk as well.
........
r58023 | gregory.p.smith | 2007-09-07 00:59:59 +0200 (Fri, 07 Sep 2007) | 4 lines
Apply the fix from Issue1112 to make this test more robust and keep
windows happy.
........
r58031 | brett.cannon | 2007-09-07 05:17:50 +0200 (Fri, 07 Sep 2007) | 4 lines
Make uuid1 and uuid4 tests conditional on whether ctypes can be imported;
implementation of either function depends on ctypes but uuid as a whole does
not.
........
r58032 | brett.cannon | 2007-09-07 06:18:30 +0200 (Fri, 07 Sep 2007) | 6 lines
Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call(). Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
........
r58034 | thomas.heller | 2007-09-07 08:32:17 +0200 (Fri, 07 Sep 2007) | 1 line
Add a 'c_longdouble' type to the ctypes module.
........
r58035 | thomas.heller | 2007-09-07 11:30:40 +0200 (Fri, 07 Sep 2007) | 1 line
Remove unneeded #include.
........
r58036 | thomas.heller | 2007-09-07 11:33:24 +0200 (Fri, 07 Sep 2007) | 6 lines
Backport from py3k branch:
Add a workaround for a strange bug on win64, when _ctypes is compiled
with the SDK compiler. This should fix the failing
Lib\ctypes\test\test_as_parameter.py test.
........
r58037 | georg.brandl | 2007-09-07 16:14:40 +0200 (Fri, 07 Sep 2007) | 2 lines
Fix a wrong indentation for sublists.
........
r58043 | georg.brandl | 2007-09-07 22:10:49 +0200 (Fri, 07 Sep 2007) | 2 lines
#1095: ln -f doesn't work portably, fix in Makefile.
........
r58049 | skip.montanaro | 2007-09-08 02:34:17 +0200 (Sat, 08 Sep 2007) | 1 line
be explicit about the actual location of the missing file
........
2007-09-08 14:39:28 -03:00
|
|
|
.. function:: set_completion_display_matches_hook([function])
|
|
|
|
|
|
|
|
Set or remove the completion display function. If *function* is
|
|
|
|
specified, it will be used as the new completion display function;
|
|
|
|
if omitted or ``None``, any completion display function already
|
2016-04-05 04:37:22 -03:00
|
|
|
installed is removed. This sets or clears the
|
|
|
|
:c:data:`rl_completion_display_matches_hook` callback in the
|
|
|
|
underlying library. The completion display function is called as
|
Merged revisions 57778-58052 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r57820 | georg.brandl | 2007-08-31 08:59:27 +0200 (Fri, 31 Aug 2007) | 2 lines
Document new shorthand notation for index entries.
........
r57827 | georg.brandl | 2007-08-31 10:47:51 +0200 (Fri, 31 Aug 2007) | 2 lines
Fix subitem markup.
........
r57833 | martin.v.loewis | 2007-08-31 12:01:07 +0200 (Fri, 31 Aug 2007) | 1 line
Mark registry components as 64-bit on Win64.
........
r57854 | bill.janssen | 2007-08-31 21:02:23 +0200 (Fri, 31 Aug 2007) | 1 line
deprecate use of FakeSocket
........
r57855 | bill.janssen | 2007-08-31 21:02:46 +0200 (Fri, 31 Aug 2007) | 1 line
remove mentions of socket.ssl in comments
........
r57856 | bill.janssen | 2007-08-31 21:03:31 +0200 (Fri, 31 Aug 2007) | 1 line
remove use of non-existent SSLFakeSocket in apparently untested code
........
r57859 | martin.v.loewis | 2007-09-01 08:36:03 +0200 (Sat, 01 Sep 2007) | 3 lines
Bug #1737210: Change Manufacturer of Windows installer to PSF.
Will backport to 2.5.
........
r57865 | georg.brandl | 2007-09-01 09:51:24 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix RST link (backport from Py3k).
........
r57876 | georg.brandl | 2007-09-01 17:49:49 +0200 (Sat, 01 Sep 2007) | 2 lines
Document sets' ">" and "<" operations (backport from py3k).
........
r57878 | skip.montanaro | 2007-09-01 19:40:03 +0200 (Sat, 01 Sep 2007) | 4 lines
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).
........
r57879 | walter.doerwald | 2007-09-01 20:18:09 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix wrong function names.
........
r57880 | walter.doerwald | 2007-09-01 20:34:05 +0200 (Sat, 01 Sep 2007) | 2 lines
Fix typo.
........
r57889 | andrew.kuchling | 2007-09-01 22:31:59 +0200 (Sat, 01 Sep 2007) | 1 line
Markup fix
........
r57892 | andrew.kuchling | 2007-09-01 22:43:36 +0200 (Sat, 01 Sep 2007) | 1 line
Add various items
........
r57895 | andrew.kuchling | 2007-09-01 23:17:58 +0200 (Sat, 01 Sep 2007) | 1 line
Wording change
........
r57896 | andrew.kuchling | 2007-09-01 23:18:31 +0200 (Sat, 01 Sep 2007) | 1 line
Add more items
........
r57904 | ronald.oussoren | 2007-09-02 11:46:07 +0200 (Sun, 02 Sep 2007) | 3 lines
Macosx: this patch ensures that the value of MACOSX_DEPLOYMENT_TARGET used
by the Makefile is also used at configure-time.
........
r57925 | georg.brandl | 2007-09-03 09:16:46 +0200 (Mon, 03 Sep 2007) | 2 lines
Fix #883466: don't allow Unicode as arguments to quopri and uu codecs.
........
r57936 | matthias.klose | 2007-09-04 01:33:04 +0200 (Tue, 04 Sep 2007) | 2 lines
- Added support for linking the bsddb module against BerkeleyDB 4.6.x.
........
r57954 | mark.summerfield | 2007-09-04 10:16:15 +0200 (Tue, 04 Sep 2007) | 3 lines
Added cross-references plus a note about dict & list shallow copying.
........
r57958 | martin.v.loewis | 2007-09-04 11:51:57 +0200 (Tue, 04 Sep 2007) | 3 lines
Document that we rely on the OS to release the crypto
context. Fixes #1626801.
........
r57960 | martin.v.loewis | 2007-09-04 15:13:14 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1388440: Add set_completion_display_matches_hook and
get_completion_type to readline.
........
r57961 | martin.v.loewis | 2007-09-04 16:19:28 +0200 (Tue, 04 Sep 2007) | 3 lines
Patch #1031213: Decode source line in SyntaxErrors back to its original
source encoding. Will backport to 2.5.
........
r57972 | matthias.klose | 2007-09-04 20:17:36 +0200 (Tue, 04 Sep 2007) | 3 lines
- Makefile.pre.in(buildbottest): Run an optional script pybuildbot.identify
to include some information about the build environment.
........
r57973 | matthias.klose | 2007-09-04 21:05:38 +0200 (Tue, 04 Sep 2007) | 2 lines
- Makefile.pre.in(buildbottest): Remove whitespace at eol.
........
r57975 | matthias.klose | 2007-09-04 22:46:02 +0200 (Tue, 04 Sep 2007) | 2 lines
- Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*.
........
r57980 | bill.janssen | 2007-09-05 02:46:27 +0200 (Wed, 05 Sep 2007) | 1 line
SSL certificate distinguished names should be represented by tuples
........
r57985 | martin.v.loewis | 2007-09-05 08:39:17 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #1105: Explain that one needs to build the solution
to get dependencies right.
........
r57987 | armin.rigo | 2007-09-05 09:51:21 +0200 (Wed, 05 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
There are probably a number of places that are open to attacks
such as the following one, in bltinmodule.c:min_max().
........
r57991 | martin.v.loewis | 2007-09-05 13:47:34 +0200 (Wed, 05 Sep 2007) | 3 lines
Patch #786737: Allow building in a tree of symlinks pointing to
a readonly source.
........
r57993 | georg.brandl | 2007-09-05 15:36:44 +0200 (Wed, 05 Sep 2007) | 2 lines
Backport from Py3k: Bug #1684991: explain lookup semantics for __special__ methods (new-style classes only).
........
r58004 | armin.rigo | 2007-09-06 10:30:51 +0200 (Thu, 06 Sep 2007) | 4 lines
Patch #1733973 by peaker:
ptrace_enter_call() assumes no exception is currently set.
This assumption is broken when throwing into a generator.
........
r58006 | armin.rigo | 2007-09-06 11:30:38 +0200 (Thu, 06 Sep 2007) | 4 lines
PyDict_GetItem() returns a borrowed reference.
This attack is against ceval.c:IMPORT_NAME, which calls an
object (__builtin__.__import__) without holding a reference to it.
........
r58013 | georg.brandl | 2007-09-06 16:49:56 +0200 (Thu, 06 Sep 2007) | 2 lines
Backport from 3k: #1116: fix reference to old filename.
........
r58021 | thomas.heller | 2007-09-06 22:26:20 +0200 (Thu, 06 Sep 2007) | 1 line
Fix typo: c_float represents to C float type.
........
r58022 | skip.montanaro | 2007-09-07 00:29:06 +0200 (Fri, 07 Sep 2007) | 3 lines
If this is correct for py3k branch and it's already in the release25-maint
branch, seems like it ought to be on the trunk as well.
........
r58023 | gregory.p.smith | 2007-09-07 00:59:59 +0200 (Fri, 07 Sep 2007) | 4 lines
Apply the fix from Issue1112 to make this test more robust and keep
windows happy.
........
r58031 | brett.cannon | 2007-09-07 05:17:50 +0200 (Fri, 07 Sep 2007) | 4 lines
Make uuid1 and uuid4 tests conditional on whether ctypes can be imported;
implementation of either function depends on ctypes but uuid as a whole does
not.
........
r58032 | brett.cannon | 2007-09-07 06:18:30 +0200 (Fri, 07 Sep 2007) | 6 lines
Fix a crasher where Python code managed to infinitely recurse in C code without
ever going back out to Python code in PyObject_Call(). Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
........
r58034 | thomas.heller | 2007-09-07 08:32:17 +0200 (Fri, 07 Sep 2007) | 1 line
Add a 'c_longdouble' type to the ctypes module.
........
r58035 | thomas.heller | 2007-09-07 11:30:40 +0200 (Fri, 07 Sep 2007) | 1 line
Remove unneeded #include.
........
r58036 | thomas.heller | 2007-09-07 11:33:24 +0200 (Fri, 07 Sep 2007) | 6 lines
Backport from py3k branch:
Add a workaround for a strange bug on win64, when _ctypes is compiled
with the SDK compiler. This should fix the failing
Lib\ctypes\test\test_as_parameter.py test.
........
r58037 | georg.brandl | 2007-09-07 16:14:40 +0200 (Fri, 07 Sep 2007) | 2 lines
Fix a wrong indentation for sublists.
........
r58043 | georg.brandl | 2007-09-07 22:10:49 +0200 (Fri, 07 Sep 2007) | 2 lines
#1095: ln -f doesn't work portably, fix in Makefile.
........
r58049 | skip.montanaro | 2007-09-08 02:34:17 +0200 (Sat, 08 Sep 2007) | 1 line
be explicit about the actual location of the missing file
........
2007-09-08 14:39:28 -03:00
|
|
|
``function(substitution, [matches], longest_match_length)`` once
|
|
|
|
each time matches need to be displayed.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. _readline-example:
|
|
|
|
|
|
|
|
Example
|
|
|
|
-------
|
|
|
|
|
|
|
|
The following example demonstrates how to use the :mod:`readline` module's
|
|
|
|
history reading and writing functions to automatically load and save a history
|
2013-05-04 15:08:35 -03:00
|
|
|
file named :file:`.python_history` from the user's home directory. The code
|
|
|
|
below would normally be executed automatically during interactive sessions
|
|
|
|
from the user's :envvar:`PYTHONSTARTUP` file. ::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-05-04 15:08:35 -03:00
|
|
|
import atexit
|
2007-08-15 11:28:22 -03:00
|
|
|
import os
|
2010-10-06 02:08:32 -03:00
|
|
|
import readline
|
2013-05-04 15:08:35 -03:00
|
|
|
|
|
|
|
histfile = os.path.join(os.path.expanduser("~"), ".python_history")
|
2007-08-15 11:28:22 -03:00
|
|
|
try:
|
|
|
|
readline.read_history_file(histfile)
|
2016-01-11 17:30:56 -04:00
|
|
|
# default history len is -1 (infinite), which may grow unruly
|
|
|
|
readline.set_history_length(1000)
|
2011-10-12 15:10:51 -03:00
|
|
|
except FileNotFoundError:
|
2007-08-15 11:28:22 -03:00
|
|
|
pass
|
2013-05-04 15:08:35 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
atexit.register(readline.write_history_file, histfile)
|
2013-05-04 15:08:35 -03:00
|
|
|
|
|
|
|
This code is actually automatically run when Python is run in
|
|
|
|
:ref:`interactive mode <tut-interactive>` (see :ref:`rlcompleter-config`).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2014-11-26 15:58:16 -04:00
|
|
|
The following example achieves the same goal but supports concurrent interactive
|
|
|
|
sessions, by only appending the new history. ::
|
|
|
|
|
|
|
|
import atexit
|
|
|
|
import os
|
2015-10-31 18:55:12 -03:00
|
|
|
import readline
|
2014-11-26 15:58:16 -04:00
|
|
|
histfile = os.path.join(os.path.expanduser("~"), ".python_history")
|
|
|
|
|
|
|
|
try:
|
|
|
|
readline.read_history_file(histfile)
|
2017-10-10 18:52:58 -03:00
|
|
|
h_len = readline.get_current_history_length()
|
2014-11-26 15:58:16 -04:00
|
|
|
except FileNotFoundError:
|
|
|
|
open(histfile, 'wb').close()
|
|
|
|
h_len = 0
|
|
|
|
|
|
|
|
def save(prev_h_len, histfile):
|
2017-10-10 18:52:58 -03:00
|
|
|
new_h_len = readline.get_current_history_length()
|
2016-01-11 17:30:56 -04:00
|
|
|
readline.set_history_length(1000)
|
2014-11-26 15:58:16 -04:00
|
|
|
readline.append_history_file(new_h_len - prev_h_len, histfile)
|
|
|
|
atexit.register(save, h_len, histfile)
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The following example extends the :class:`code.InteractiveConsole` class to
|
|
|
|
support history save/restore. ::
|
|
|
|
|
|
|
|
import atexit
|
2013-05-04 15:08:35 -03:00
|
|
|
import code
|
2007-08-15 11:28:22 -03:00
|
|
|
import os
|
2013-05-04 15:08:35 -03:00
|
|
|
import readline
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
class HistoryConsole(code.InteractiveConsole):
|
|
|
|
def __init__(self, locals=None, filename="<console>",
|
|
|
|
histfile=os.path.expanduser("~/.console-history")):
|
2009-09-16 13:00:31 -03:00
|
|
|
code.InteractiveConsole.__init__(self, locals, filename)
|
2007-08-15 11:28:22 -03:00
|
|
|
self.init_history(histfile)
|
|
|
|
|
|
|
|
def init_history(self, histfile):
|
|
|
|
readline.parse_and_bind("tab: complete")
|
|
|
|
if hasattr(readline, "read_history_file"):
|
|
|
|
try:
|
|
|
|
readline.read_history_file(histfile)
|
2011-10-12 15:10:51 -03:00
|
|
|
except FileNotFoundError:
|
2007-08-15 11:28:22 -03:00
|
|
|
pass
|
|
|
|
atexit.register(self.save_history, histfile)
|
|
|
|
|
|
|
|
def save_history(self, histfile):
|
2016-01-11 17:30:56 -04:00
|
|
|
readline.set_history_length(1000)
|
2007-08-15 11:28:22 -03:00
|
|
|
readline.write_history_file(histfile)
|