The UTF-8 encoding system is used by default on most operating systems, but
not all of them. This can cause the ’24:checkpatch - AUTHORS.rst existence’
test to fail with a UnicodeDecodeError. All Python versions < 3.15 are
affected, resolved in PEP 686 (https://peps.python.org/pep-0686/)

Signed-off-by: Ivan Burnin <[email protected]>
---
 utilities/checkpatch.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 6bcaf2dfd..38d6f02c7 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -862,7 +862,8 @@ def do_authors_exist(authors):
     missing_authors = []
 
     try:
-        with open(get_top_directory() + "/AUTHORS.rst", "r") as file:
+        authors_file = get_top_directory() + "/AUTHORS.rst"
+        with open(authors_file, "r", encoding="utf-8") as file:
             file_content = file.read()
             for author in authors:
                 m = re.search(r'<(.*?)>', author)
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to