Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export more libreadline API functions #41788

Open
BruceEdge mannequin opened this issue Apr 1, 2005 · 10 comments
Open

Export more libreadline API functions #41788

BruceEdge mannequin opened this issue Apr 1, 2005 · 10 comments
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@BruceEdge
Copy link
Mannequin

BruceEdge mannequin commented Apr 1, 2005

BPO 1175004
Nosy @mwhudson, @loewis, @ned-deily, @vadmium
Dependencies
  • bpo-23067: Export readline forced_update_display
  • Files
  • export_more_libreadline_api.patch: API expansion patch, with docs this time
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2005-04-01.19:30:23.000>
    labels = ['extension-modules', 'type-feature']
    title = 'Export more libreadline API functions'
    updated_at = <Date 2015-08-02.01:26:19.724>
    user = 'https://bugs.python.org/bruceedge'

    bugs.python.org fields:

    activity = <Date 2015-08-02.01:26:19.724>
    actor = 'martin.panter'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2005-04-01.19:30:23.000>
    creator = 'bruce_edge'
    dependencies = ['23067']
    files = ['6584']
    hgrepos = []
    issue_num = 1175004
    keywords = ['patch']
    message_count = 10.0
    messages = ['48122', '48123', '48124', '48125', '48126', '48127', '93159', '116708', '247841', '247848']
    nosy_count = 7.0
    nosy_names = ['mwh', 'loewis', 'bruce_edge', 'strank', 'ned.deily', 'sa', 'martin.panter']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1175004'
    versions = ['Python 3.2']

    @BruceEdge
    Copy link
    Mannequin Author

    BruceEdge mannequin commented Apr 1, 2005

    The python readline.c is missing several of the API
    funcs provided by libreadline. This patch adds the
    missing ones that I needed.
    Add support for libreadline callbacks to python functions.
    eg:
    readline.set_py_callback_hook( my_func )

    Also, export rl_delete_text, rl_message,
    rl_on_new_line, rl_forced_update_display,
    rl_position_cursor

    -Bruce

    @BruceEdge BruceEdge mannequin added extension-modules C modules in the Modules dir labels Apr 1, 2005
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 1, 2005

    Logged In: YES
    user_id=21627

    Have these function always been available in readline (i.e.
    all readline versions)? If not, please provide configure.in
    changes.

    Also, please provide Doc/lib/libreadline.tex changes.

    If you cannot provide these things, please indicate so.

    @BruceEdge
    Copy link
    Mannequin Author

    BruceEdge mannequin commented Apr 1, 2005

    Logged In: YES
    user_id=1251183

    AFAIK, yes, they have always been available, at least in
    Linux. I've been carrying this patch around since python 2.1.
    I have not looked into this on other platforms.
    I can't commit to providing doc changes. With my schedule,
    it was all I could do to package it up and send it in.
    I'm sorry, I know this is incomplete work, but I figure
    someone may be able to use it.

    -Bruce

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Apr 1, 2005

    Logged In: YES
    user_id=21627

    As incomplete work, we might have to reject it, unless
    somebody volunteers to complete it. Let's give it one month
    from now.

    @BruceEdge
    Copy link
    Mannequin Author

    BruceEdge mannequin commented Apr 4, 2005

    Logged In: YES
    user_id=1251183

    I got the OK to work on the docs. Here's the patch
    resubmitted with the libreadline.tex changes.

    -Bruce

    @mwhudson
    Copy link

    Logged In: YES
    user_id=6656

    I've just broken this patch by changing the signature of the set_hook/
    on_hook functions.

    There seem to be some whitespace oddities (e.g. right at the start of the
    patch).

    The docstrings should use the PyDoc_STRVAR macros.

    I'm not sure about some of the details of the py_callback stuff (although
    the functionality seems desirable):

    1. the name -- I think I'd find python_command more transparent
    2. it would be nice to pass the count and key arguments to the Python
      callable
    3. the comments around it's implementation don't make much sense to
      me.
    4. the example in the docs -- which is what finally clued me in to what the
      function did :) -- isn't self-contained.

    None of this should be very hard to deal with, but I don't know when/if I'd
    get round to it myself.

    @devdanzin devdanzin mannequin added type-feature A feature request or enhancement labels Feb 15, 2009
    @sa
    Copy link
    Mannequin

    sa mannequin commented Sep 26, 2009

    Access to rl_reset_line_state (and possibly others in the Redisplay
    section) are also required, otherwise it's not possible to recover from
    KeyboardInterrupt during raw_input() if readline isn't in the expected
    editing mode.

    Example:

    1. call raw_input() and use ctrl-R (reverse-i-search)
    2. catch a KeyboardInterrupt
    3. call raw_input() again

    The input editing is still in reverse-i-search mode.
    This makes it impractical to use raw_input() again after
    KeyboardInterrupt because the input buffer may be in an unknown state.
    If the history is modified then the search will break and character
    input will appear to be ignored.

    Note: It may be desirable to stay in this mode and call raw_input()
    again, ignoring KeyboardInterrupt entirely (although the prompt is
    redisplayed when exiting search mode so that doesn't currently work
    cleanly), so it can't just auto-reset on KeyboardInterrupt.

    The documentation should explain how to resume after KeyboardInterrupt
    safely.

    @ned-deily
    Copy link
    Member

    bpo-1744456 contains a different patch to implement readline callbacks. Suggest that anyone moving forward with this review both patches.

    @vadmium
    Copy link
    Member

    vadmium commented Aug 2, 2015

    Simon: See bpo-24266 about recovering after interrupting the search mode.

    Also, I think bpo-1744456 wraps a different part of the Readline API (rl_callback_ for non-blocking interface) to the patch here (rl_add_defun for adding a custom “key binding” or something). So the two patches could be considered independently.

    @vadmium
    Copy link
    Member

    vadmium commented Aug 2, 2015

    rl_forced_update_display() wrappers already proposed in bpo-23067

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants