Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-128066: Fixed PyREPL history saving on read-only file systems #128088

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

Closed

Conversation

vladimir-poghosyan
Copy link

@vladimir-poghosyan vladimir-poghosyan commented Dec 19, 2024

As suggested in the comment of the linked issue by @ZeroIntensity, I simply handled the exception with a resulting warning.

@ghost
Copy link

ghost commented Dec 19, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

Lib/_pyrepl/readline.py Outdated Show resolved Hide resolved
Copy link
Contributor

@skirpichev skirpichev left a comment

Choose a reason for hiding this comment

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

LGTM in general, with few concerns.

  1. Maybe it worth a test.
  2. I worry, that error is too late. Though, this will be fixed by gh-127495: Append to history file after every statement in PyREPL #132294.

@vladimir-poghosyan
Copy link
Author

Thank you for reviewing the PR.

I looked through your mentioned pull request an noticed that the call to append_history_file is wrapped in except (FileNotFoundError, PermissionError) exception handler, thus still prone to the same read-only file system error, or am I missing something?

Will it be better, that I add OSError to the except (FileNotFoundError, PermissionError) in the site.py (where the write_history_file is called) with a warning message and leave its implementation as it was? In that way file handling code in both write_history_file and append_history_file methods will match.

@skirpichev
Copy link
Contributor

I looked through your mentioned pull request an noticed that the call to append_history_file is wrapped in except (FileNotFoundError, PermissionError) exception handler

Now I also catch OSError like in your pr.

Will it be better, that I add OSError to the except (FileNotFoundError, PermissionError) in the site.py

Hmm, maybe. (BTW I doubt that FileNotFoundError is relevant at all.)

@vladimir-poghosyan
Copy link
Author

vladimir-poghosyan commented Apr 11, 2025

I've changed my implementation and moved error handling to the site.py. Regarding the the FileNotFoundError being caught, I think that it is relevant for missing directories in the history file path.

@ambv
Copy link
Contributor

ambv commented May 20, 2025

Closing in favor of #134380.

@ambv ambv closed this May 20, 2025
@vladimir-poghosyan vladimir-poghosyan deleted the fix-issue-128066 branch May 31, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.