forked from pool/python-cpplint
46 lines
2.0 KiB
Diff
46 lines
2.0 KiB
Diff
|
|
From fe579d0e248f2f1f977ecb902f7a2eb1a4a66eef Mon Sep 17 00:00:00 2001
|
||
|
|
From: Steve Kowalik <steven@wedontsleep.org>
|
||
|
|
Date: Fri, 31 Oct 2025 12:50:26 +1100
|
||
|
|
Subject: [PATCH 1/3] Drop use of codecs.open()
|
||
|
|
|
||
|
|
codecs.open() has been deprecated as of Python 3.14, and plain open()
|
||
|
|
supports all use-cases we have, switch to using it.
|
||
|
|
---
|
||
|
|
cpplint.py | 15 +++++++++------
|
||
|
|
1 file changed, 9 insertions(+), 6 deletions(-)
|
||
|
|
|
||
|
|
Index: cpplint-2.0.2/cpplint.py
|
||
|
|
===================================================================
|
||
|
|
--- cpplint-2.0.2.orig/cpplint.py
|
||
|
|
+++ cpplint-2.0.2/cpplint.py
|
||
|
|
@@ -7448,7 +7448,7 @@ def ProcessConfigOverrides(filename):
|
||
|
|
continue
|
||
|
|
|
||
|
|
try:
|
||
|
|
- with codecs.open(cfg_file, "r", "utf8", "replace") as file_handle:
|
||
|
|
+ with open(cfg_file, encoding="utf8", errors="replace") as file_handle:
|
||
|
|
for line in file_handle:
|
||
|
|
line, _, _ = line.partition("#") # Remove comments.
|
||
|
|
if not line.strip():
|
||
|
|
@@ -7541,16 +7541,15 @@ def ProcessFile(filename, vlevel, extra_
|
||
|
|
crlf_lines = []
|
||
|
|
try:
|
||
|
|
# Support the UNIX convention of using "-" for stdin. Note that
|
||
|
|
- # we are not opening the file with universal newline support
|
||
|
|
- # (which codecs doesn't support anyway), so the resulting lines do
|
||
|
|
- # contain trailing '\r' characters if we are reading a file that
|
||
|
|
- # has CRLF endings.
|
||
|
|
+ # we are not opening the file with universal newline support,
|
||
|
|
+ # so the resulting lines do # contain trailing '\r' characters
|
||
|
|
+ # if we are reading a file that # has CRLF endings.
|
||
|
|
# If after the split a trailing '\r' is present, it is removed
|
||
|
|
# below.
|
||
|
|
if filename == "-":
|
||
|
|
lines = sys.stdin.read().split("\n")
|
||
|
|
else:
|
||
|
|
- with codecs.open(filename, "r", "utf8", "replace") as target_file:
|
||
|
|
+ with open(filename, encoding="utf8", errors="replace") as target_file:
|
||
|
|
lines = target_file.read().split("\n")
|
||
|
|
|
||
|
|
# Remove trailing '\r'.
|