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

readline does not offer partial saves #67129

Closed
bru mannequin opened this issue Nov 25, 2014 · 3 comments
Closed

readline does not offer partial saves #67129

bru mannequin opened this issue Nov 25, 2014 · 3 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@bru
Copy link
Mannequin

bru mannequin commented Nov 25, 2014

BPO 22940
Files
  • 0001-Add-readline.append_history_file-function.patch: Patch adding readline.append_history_file(nelements, [filepath])
  • 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 = <Date 2014-11-26.19:58:42.436>
    created_at = <Date 2014-11-25.14:30:57.143>
    labels = ['type-feature', 'library']
    title = 'readline does not offer partial saves'
    updated_at = <Date 2014-11-26.21:03:20.317>
    user = 'https://bugs.python.org/bru'

    bugs.python.org fields:

    activity = <Date 2014-11-26.21:03:20.317>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-11-26.19:58:42.436>
    closer = 'python-dev'
    components = ['Library (Lib)']
    creation = <Date 2014-11-25.14:30:57.143>
    creator = 'bru'
    dependencies = []
    files = ['37275']
    hgrepos = []
    issue_num = 22940
    keywords = ['patch']
    message_count = 3.0
    messages = ['231661', '231726', '231730']
    nosy_count = 2.0
    nosy_names = ['python-dev', 'bru']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue22940'
    versions = ['Python 3.5']

    @bru
    Copy link
    Mannequin Author

    bru mannequin commented Nov 25, 2014

    The "readline" module offers "write_history_file" from readline/history.h "write_history", but there's no "append_history_file" that would invoke "append_history" from the C header.

    This causes inconveniences when saving history to a file (like shown there: https://docs.python.org/3.5/library/readline.html?highlight=readline#example). Indeed, say you have 2 interpreters (A) and (B) open.

    • (A) and (B) load the history, composed of (z) lines
    • you work on both, writing (a) lines in (A) and (b) lines in (b)
    • you close (A), the history file now has (z)+(a)
    • you close (B), the history file now has (z)+(b)
      Therefore (A) history (the (a) lines) is lost. Offering "append_history_file" would be a nice way to fix this problem: having (z)+(a)+(b) in the end would be easy.

    This is exactly what the attached patch does. With it are tests, doc and an example. I've not updated Misc/NEWS yet though (no issue #).

    @bru bru mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 25, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 26, 2014

    New changeset ff00588791be by Benjamin Peterson in branch 'default':
    add readline.append_history_file (closes bpo-22940)
    https://hg.python.org/cpython/rev/ff00588791be

    @python-dev python-dev mannequin closed this as completed Nov 26, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 26, 2014

    New changeset c8bcede1b37a by Ned Deily in branch 'default':
    bpo-22940: fixes to editline support
    https://hg.python.org/cpython/rev/c8bcede1b37a

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

    No branches or pull requests

    0 participants