fix: replace deprecated codecs.open() with built-in open() (#429)#428
Merged
squidfunk merged 1 commit intozensical:masterfrom Mar 11, 2026
Merged
Conversation
|
All commits verified and signed off. |
68d43be to
4ab86d5
Compare
4ab86d5 to
fd6c421
Compare
codecs.open() with built-in open()
Member
|
Thanks for the PR! We already fixed this in Material 6 months ago, but the code was carried over before the fix and we didn't apply it here, so thanks for raising this and providing a fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace
codecs.open()with the built-inopen()inpython/zensical/extensions/emoji.pyto resolve aDeprecationWarningon Python 3.14+.Background
codecs.open()was deprecated in CPython 3.14 (python/cpython#133036, python/cpython#133038). The built-inopen()withencodingparameter is the official replacement, available since Python 3.0 — safe for the full supported range (>=3.10).See also:
Changes
python/zensical/extensions/emoji.pycodecs.open(file, encoding="utf-8")→open(file, encoding="utf-8"), remove unusedimport codecsNotes
open()returnsTextIOWrapper(C impl) vscodecs.open()returningStreamReaderWriter(pure Python) — functionally identical for UTF-8 text reading, marginally fasterDeprecationWarningfor Python 3.14+ usersAI disclosure
This PR was created with the assistance of Claude Code. The change has been thoroughly reviewed and fully understood by the author — it is a straightforward 1:1 replacement of
codecs.open()with the built-inopen(), as officially recommended by CPython (python/cpython#133036). The author takes full responsibility for the correctness of this contribution.