Skip to content

Commit c68f1c3

Browse files
committed
tools: use open instead of codecs.open in cpplint
with Python 3.14, codecs.open is deprecated, and thus introduce open instead. Fixes: #60771
1 parent 768f3ba commit c68f1c3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/cpplint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6179,7 +6179,7 @@ def UpdateIncludeState(filename, include_dict, io=codecs):
61796179
"""
61806180
headerfile = None
61816181
try:
6182-
with io.open(filename, 'r', 'utf8', 'replace') as headerfile:
6182+
with open(filename, encoding='utf-8', errors='replace') as headerfile:
61836183
linenum = 0
61846184
for line in headerfile:
61856185
linenum += 1
@@ -6706,7 +6706,7 @@ def ProcessConfigOverrides(filename):
67066706
continue
67076707

67086708
try:
6709-
with codecs.open(cfg_file, 'r', 'utf8', 'replace') as file_handle:
6709+
with open(cfg_file, encoding='utf-8', errors='replace') as file_handle:
67106710
for line in file_handle:
67116711
line, _, _ = line.partition('#') # Remove comments.
67126712
if not line.strip():
@@ -6809,7 +6809,7 @@ def ProcessFile(filename, vlevel, extra_check_functions=None):
68096809
codecs.getwriter('utf8'),
68106810
'replace').read().split('\n')
68116811
else:
6812-
with codecs.open(filename, 'r', 'utf8', 'replace') as target_file:
6812+
with open(filename, encoding='utf-8', errors='replace') as target_file:
68136813
lines = target_file.read().split('\n')
68146814

68156815
# Remove trailing '\r'.

0 commit comments

Comments
 (0)