[clang] [clang][docs] Remove Python2 import handler in dump_ast_matchers.py (PR #163730)

David Spickett via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 16 03:08:03 PDT 2025


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/163730

LLVM requires Python >=3.8 and in Python 3.0 urllib2 was renamed to urllib.

https://docs.python.org/3/whatsnew/3.0.html#library-changes

>From 9e4e8bf34098b03a83db320b18b295325e9038db Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Thu, 16 Oct 2025 10:06:39 +0000
Subject: [PATCH] [clang][docs] Remove Python2 import handler in
 dump_ast_matchers.py

LLVM requires Python >=3.8 and in Python 3.0 urllib2 was renamed
to urllib.

https://docs.python.org/3/whatsnew/3.0.html#library-changes
---
 clang/docs/tools/dump_ast_matchers.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py
index 46b7bb718ba08..5db6826070934 100755
--- a/clang/docs/tools/dump_ast_matchers.py
+++ b/clang/docs/tools/dump_ast_matchers.py
@@ -6,11 +6,8 @@
 import collections
 import re
 import os
+from urllib.request import urlopen
 
-try:
-    from urllib.request import urlopen
-except ImportError:
-    from urllib2 import urlopen
 
 CLASS_INDEX_PAGE_URL = "https://clang.llvm.org/doxygen/classes.html"
 try:



More information about the cfe-commits mailing list