fix(clint.py): replace deprecated codecs.open #36593

Remove codecs import and use open(..., encoding='utf-8', errors='replace', newline=None) in clint.py to avoid Python 3.14 DeprecationWarning; preserve existing CR handling.
This commit is contained in:
Vendetta
2025-11-18 23:05:42 +05:30
committed by GitHub
parent 4b8980949c
commit 2483d5ad8a

View File

@@ -37,7 +37,6 @@ from perfect (in either direction).
"""
import codecs
import copy
import getopt
import os
@@ -2257,8 +2256,8 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]):
if _cpplint_state.stdin_filename is not None:
filename = _cpplint_state.stdin_filename
else:
lines = codecs.open(
filename, 'r', 'utf8', 'replace').read().split('\n')
lines = open(
filename, 'r', encoding='utf-8', errors='replace', newline=None).read().split('\n')
# Remove trailing '\r'.
for linenum in range(len(lines)):