Skip to content

gh-119310: Fix encoding when reading old history file #121779

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

Merged
merged 7 commits into from
Sep 6, 2024

Conversation

aorcajo
Copy link
Contributor

@aorcajo aorcajo commented Jul 14, 2024

This fixes the problem reading history files created with previous versions of python (that where using GNU readline). Checks that the file was created by readline and change the encoding to unicode-escape.

@ghost
Copy link

ghost commented Jul 14, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Jul 14, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

1 similar comment
@bedevere-app
Copy link

bedevere-app bot commented Jul 15, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@aorcajo aorcajo marked this pull request as ready for review July 15, 2024 11:28
@bedevere-app
Copy link

bedevere-app bot commented Jul 16, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@aorcajo aorcajo force-pushed the fix-issue-119310 branch from 2ac46fd to d009abf Compare July 16, 2024 10:04
@bedevere-app
Copy link

bedevere-app bot commented Jul 16, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app
Copy link

bedevere-app bot commented Jul 19, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app
Copy link

bedevere-app bot commented Jul 19, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Comment on lines +1127 to +1131
def test_readline_history_file(self):
# skip, if readline module is not available
readline = import_module('readline')
if readline.backend != "editline":
self.skipTest("GNU readline is not affected by this issue")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since what we're trying to do is to fix reading old history files, you could add three history files to test data:

  • an editline history file
  • a readline history file
  • a pyrepl history file with multiline blocks

That way all three would have tests and we wouldn't regress on all three fronts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will have to wait for a future enhancement.

@ambv ambv added the needs backport to 3.13 bugs and security fixes label Sep 6, 2024
@ambv ambv merged commit e959848 into python:main Sep 6, 2024
42 checks passed
@miss-islington-app
Copy link

Thanks @aorcajo for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 6, 2024
…-121779)

(cherry picked from commit e959848)

Co-authored-by: aorcajo <589252+aorcajo@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
@bedevere-app
Copy link

bedevere-app bot commented Sep 6, 2024

GH-123784 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 6, 2024
ambv added a commit that referenced this pull request Sep 6, 2024
…) (#123784)

(cherry picked from commit e959848)

Co-authored-by: aorcajo <589252+aorcajo@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants