From add5b811ae51d2f155b99af82db48a61e4fd76ef Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Thu, 26 Mar 2026 22:47:00 -0500 Subject: [PATCH] [libclang/python] Renaming `get_version` into `get_clang_version` (#188515) Rename `get_version` to `get_clang_version` to match the `libclang.so` name[1], and be clear we doesn't return some `cindex.py` internal versioning but the `libclang.so` one. [1] This match was some current API are doing for example `conf.lib.clang_getArraySize` is mapped to `get_array_size`. --- clang/bindings/python/clang/cindex.py | 2 +- clang/bindings/python/tests/cindex/test_version.py | 2 +- clang/docs/ReleaseNotes.rst | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index 6e8ea782df74..b71f9ed2275e 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -4650,7 +4650,7 @@ class Config: return library - def get_version(self): + def get_clang_version(self) -> str: """ Returns the libclang version string used by the bindings """ diff --git a/clang/bindings/python/tests/cindex/test_version.py b/clang/bindings/python/tests/cindex/test_version.py index 0540185221da..2b25b0bd1c52 100755 --- a/clang/bindings/python/tests/cindex/test_version.py +++ b/clang/bindings/python/tests/cindex/test_version.py @@ -6,6 +6,6 @@ from clang.cindex import Config class TestClangVersion(unittest.TestCase): def test_get_version_format(self): conf = Config() - version = conf.get_version() + version = conf.get_clang_version() self.assertRegex(version, r"^clang version \d+\.\d+\.\d+") diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 1ab3aae64060..80913393e69c 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -580,8 +580,8 @@ Python Binding Changes ``CodeCompletionResults.results`` should be changed to directly use ``CodeCompletionResults``: it nows supports ``__len__`` and ``__getitem__``, so it can be used the same as ``CodeCompletionResults.results``. -- Added a new helper method ``get_version`` to the class ``Config`` to read the - version string of the libclang in use. +- Added a new helper method ``get_clang_version`` to the class ``Config`` to + read the version string of the libclang in use. OpenMP Support --------------