Skip to content

Commit 5e74292

Browse files
committed
fix: replace deprecated codecs.open with built-in open (#128)
Python 3.14 emits a DeprecationWarning for codecs.open(), which gitdb hits inside ReferenceDB._update_dbs_from_ref_file: DeprecationWarning: codecs.open() is deprecated. Use open() instead. The built-in open() has supported the encoding kwarg since Python 3.0 and the call site already passes encoding="utf-8", so the replacement is byte-for-byte equivalent on every supported Python version. Dropped the now-unused codecs import. Verified the change with the existing test_ref.py suite. Closes #128
1 parent 5c1b303 commit 5e74292

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

gitdb/db/ref.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# This module is part of GitDB and is released under
44
# the New BSD License: https://opensource.org/license/bsd-3-clause/
5-
import codecs
65
from gitdb.db.base import (
76
CompoundDB,
87
)
@@ -42,7 +41,7 @@ def _update_dbs_from_ref_file(self):
4241
# try to get as many as possible, don't fail if some are unavailable
4342
ref_paths = list()
4443
try:
45-
with codecs.open(self._ref_file, 'r', encoding="utf-8") as f:
44+
with open(self._ref_file, 'r', encoding="utf-8") as f:
4645
ref_paths = [l.strip() for l in f]
4746
except OSError:
4847
pass

0 commit comments

Comments
 (0)