Skip to content

Conversation

@DavidSpickett
Copy link
Collaborator

@DavidSpickett DavidSpickett commented Oct 16, 2025

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.

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.
@llvmbot llvmbot added clang Clang issues not falling into any other category llvm-lit testing-tools labels Oct 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2025

@llvm/pr-subscribers-testing-tools

@llvm/pr-subscribers-clang

Author: David Spickett (DavidSpickett)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/163727.diff

5 Files Affected:

  • (modified) clang/tools/scan-view/share/ScanView.py (+1-5)
  • (modified) clang/utils/check_cfc/check_cfc.py (+1-5)
  • (modified) llvm/utils/lit/tests/Inputs/test-data-micro/dummy_format.py (+2-6)
  • (modified) llvm/utils/lit/tests/Inputs/test-data/dummy_format.py (+2-6)
  • (modified) llvm/utils/lit/tests/Inputs/xunit-output/dummy_format.py (+2-6)
diff --git a/clang/tools/scan-view/share/ScanView.py b/clang/tools/scan-view/share/ScanView.py
index a89bf3f24fc5a..c395b9590e0ee 100644
--- a/clang/tools/scan-view/share/ScanView.py
+++ b/clang/tools/scan-view/share/ScanView.py
@@ -29,11 +29,7 @@
 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 8d42ec532bbb7..7658f6c27009b 100755
--- a/clang/utils/check_cfc/check_cfc.py
+++ b/clang/utils/check_cfc/check_cfc.py
@@ -56,11 +56,7 @@
 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 b400083a0d967..27b738edf8e14 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 @@ def execute(self, test, lit_config):
 
         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 30bd1814a6a42..b4c1b92637d01 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 @@ def execute(self, test, lit_config):
 
         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 efac0b561c44b..43da0973df614 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 @@ def execute(self, test, lit_config):
 
         source_path = test.getSourcePath()
 
-        cfg = ConfigParser.ConfigParser()
+        cfg = configparser.ConfigParser()
         cfg.read(source_path)
 
         # Create the basic test result.

@DavidSpickett DavidSpickett requested a review from tru October 16, 2025 11:11
@DavidSpickett DavidSpickett merged commit 94f3eee into llvm:main Oct 31, 2025
14 checks passed
@DavidSpickett DavidSpickett deleted the python-configparser branch October 31, 2025 09:45
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
…vm#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category llvm-lit testing-tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants