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

Prevent duplicates in readline history #36669

Closed
smontanaro opened this issue May 30, 2002 · 5 comments
Closed

Prevent duplicates in readline history #36669

smontanaro opened this issue May 30, 2002 · 5 comments
Assignees
Labels
extension-modules C modules in the Modules dir

Comments

@smontanaro
Copy link
Contributor

BPO 562492
Nosy @gvanrossum, @smontanaro
Files
  • readline.diff
  • 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 = 'https://github.com/smontanaro'
    closed_at = <Date 2002-06-11.14:33:37.000>
    created_at = <Date 2002-05-30.17:47:33.000>
    labels = ['extension-modules']
    title = 'Prevent duplicates in readline history'
    updated_at = <Date 2002-06-11.14:33:37.000>
    user = 'https://github.com/smontanaro'

    bugs.python.org fields:

    activity = <Date 2002-06-11.14:33:37.000>
    actor = 'skip.montanaro'
    assignee = 'skip.montanaro'
    closed = True
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2002-05-30.17:47:33.000>
    creator = 'skip.montanaro'
    dependencies = []
    files = ['4311']
    hgrepos = []
    issue_num = 562492
    keywords = ['patch']
    message_count = 5.0
    messages = ['40187', '40188', '40189', '40190', '40191']
    nosy_count = 2.0
    nosy_names = ['gvanrossum', 'skip.montanaro']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue562492'
    versions = ['Python 2.3']

    @smontanaro
    Copy link
    Contributor Author

    Someone complained awhile back on c.l.py that Python's readline
    history gets duplicates when you ^P to reexecute the previous
    command. I believe the attached patch fixes that. As far as I could
    tell, the memory returned by history_get_history_state() is malloc'd,
    though that's not documented in the version of the history docs I
    have and I didn't have the source handy to check. Someone needs
    to verify that before any such change is incorporated into the code
    base. (I will download the readline/history source and check if
    nobody else can confirm easily.)

    Note that I also added a call to using_history() in setup_readline(). I
    believe that's what the history docs indicate you should do, though it
    doesn't seem to be strictly necessary.

    Skip

    @smontanaro smontanaro self-assigned this May 30, 2002
    @smontanaro smontanaro added the extension-modules C modules in the Modules dir label May 30, 2002
    @gvanrossum
    Copy link
    Member

    Logged In: YES
    user_id=6380

    I like this idea, but I suggest that you check the readline
    source to confirm your hypothesis about the need to free
    (state). You might want to check different versions of readline
    too -- we're trying to be compatible with readline 2.2 through
    4.x.

    @smontanaro
    Copy link
    Contributor Author

    Logged In: YES
    user_id=44345

    I checked the readline 2.0 and 4.2a sources (the oldest and newest tarballs
    available from ftp.gnu.org). The history_get_history_state function in both
    versions malloc's the state.

    Skip

    @gvanrossum
    Copy link
    Member

    Logged In: YES
    user_id=6380

    OK, then go for it.

    @smontanaro
    Copy link
    Contributor Author

    Logged In: YES
    user_id=44345

    incorporated as Modules/readline.c 2.50

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants