-
Notifications
You must be signed in to change notification settings - Fork 111
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
Fix for Issue 778. #779
base: master
Are you sure you want to change the base?
Fix for Issue 778. #779
Conversation
…tegories raise OSError on MacOSX
…ebook.journal.Journal.categories() to use utils.safe_strxfrm in sorting categories instead of locale.strxfrm that was raising OSError in case of characters incompatible with the current locale; added tests.test_journal.py to test the fix for issue-778
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this!
@@ -1,3 +1,6 @@ | |||
# 2.36 (2024-10-24) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 2.36 (2024-10-24) | |
# 2.36 (unreleased) |
@@ -1,3 +1,6 @@ | |||
# 2.36 (2024-10-24) | |||
* Fix: Categories with characters incompatible with the current locale opens (#778, Oussama Jarrousse). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Fix: Categories with characters incompatible with the current locale opens (#778, Oussama Jarrousse). | |
* Fix sorting words that are incompatible with the current locale (#778, #779, Oussama Jarrousse). |
@@ -202,3 +203,14 @@ def flush(self): | |||
def close(self): | |||
for stream in self.streams: | |||
stream.close() | |||
|
|||
def safe_strxfrm(value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def safe_strxfrm(value): | |
def safe_strxfrm(s: str): |
return locale.strxfrm(value) | ||
except OSError: | ||
return value | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need the bare except? I think it's better to remove it since we have the except for OSError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test!
You can ignore the failing Mac test. But please see that the other tests pass. |
Summary of the changes in this pull request
Pull request checklist
CHANGELOG.md
including my name and issue and/or pull request number.TODO.md
.