From 94f3eeee9489ba1402fbf520f9927cca8b4b9ca7 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 31 Oct 2025 09:45:55 +0000 Subject: [PATCH] [llvm][clang] Remove handling of Python2 ConfigParser module name (#163727) LLVM now requires Python >= 3.8, and ConfigParser was renamed to configparser in 3.0: https://docs.python.org/3/whatsnew/3.0.html#library-changes A few places imported it under the Python2 name even for Python3, I have swapped those to the Python3 name. This was reported by https://pypi.org/project/vermin/ as the file having incompatible versions. Since once import is 2.x and one is 3.x. --- clang/tools/scan-view/share/ScanView.py | 6 +----- clang/utils/check_cfc/check_cfc.py | 6 +----- .../lit/tests/Inputs/test-data-micro/dummy_format.py | 8 ++------ llvm/utils/lit/tests/Inputs/test-data/dummy_format.py | 8 ++------ llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py | 8 ++------ 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/clang/tools/scan-view/share/ScanView.py b/clang/tools/scan-view/share/ScanView.py index a89bf3f24fc5..c395b9590e0e 100644 --- a/clang/tools/scan-view/share/ScanView.py +++ b/clang/tools/scan-view/share/ScanView.py @@ -29,11 +29,7 @@ import socket import itertools import Reporter - -try: - import configparser -except ImportError: - import ConfigParser as configparser +import configparser ### # Various patterns matched or replaced by server. diff --git a/clang/utils/check_cfc/check_cfc.py b/clang/utils/check_cfc/check_cfc.py index 8d42ec532bbb..7658f6c27009 100755 --- a/clang/utils/check_cfc/check_cfc.py +++ b/clang/utils/check_cfc/check_cfc.py @@ -56,11 +56,7 @@ import shutil import subprocess import sys import tempfile - -try: - import configparser -except ImportError: - import ConfigParser as configparser +import configparser import io import obj_diff diff --git a/llvm/utils/lit/tests/Inputs/test-data-micro/dummy_format.py b/llvm/utils/lit/tests/Inputs/test-data-micro/dummy_format.py index b400083a0d96..27b738edf8e1 100644 --- a/llvm/utils/lit/tests/Inputs/test-data-micro/dummy_format.py +++ b/llvm/utils/lit/tests/Inputs/test-data-micro/dummy_format.py @@ -1,9 +1,5 @@ import os - -try: - import ConfigParser -except ImportError: - import configparser as ConfigParser +import configparser import lit.formats import lit.Test @@ -16,7 +12,7 @@ class DummyFormat(lit.formats.FileBasedTest): source_path = test.getSourcePath() - cfg = ConfigParser.ConfigParser() + cfg = configparser.ConfigParser() cfg.read(source_path) # Create the basic test result. diff --git a/llvm/utils/lit/tests/Inputs/test-data/dummy_format.py b/llvm/utils/lit/tests/Inputs/test-data/dummy_format.py index 30bd1814a6a4..b4c1b92637d0 100644 --- a/llvm/utils/lit/tests/Inputs/test-data/dummy_format.py +++ b/llvm/utils/lit/tests/Inputs/test-data/dummy_format.py @@ -1,9 +1,5 @@ import os - -try: - import ConfigParser -except ImportError: - import configparser as ConfigParser +import configparser import lit.formats import lit.Test @@ -16,7 +12,7 @@ class DummyFormat(lit.formats.FileBasedTest): source_path = test.getSourcePath() - cfg = ConfigParser.ConfigParser() + cfg = configparser.ConfigParser() cfg.read(source_path) # Create the basic test result. diff --git a/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py b/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py index efac0b561c44..43da0973df61 100644 --- a/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py +++ b/llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py @@ -1,9 +1,5 @@ import os - -try: - import ConfigParser -except ImportError: - import configparser as ConfigParser +import configparser import lit.formats import lit.Test @@ -16,7 +12,7 @@ class DummyFormat(lit.formats.FileBasedTest): source_path = test.getSourcePath() - cfg = ConfigParser.ConfigParser() + cfg = configparser.ConfigParser() cfg.read(source_path) # Create the basic test result.