-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libclang/python] Ensure all used library functions are registered #140015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang Author: Jannick Kremer (DeinAlptraum) ChangesAdd a few library functions that were not previously registered to the Add a test to check that all library functions are properly registered. This is not 100% reliable: for a yet unkown reason, Full diff: https://github.com/llvm/llvm-project/pull/140015.diff 1 Files Affected:
diff --git a/clang/bindings/python/tests/cindex/test_lib.py b/clang/bindings/python/tests/cindex/test_lib.py
new file mode 100644
index 0000000000000..f8f892731500b
--- /dev/null
+++ b/clang/bindings/python/tests/cindex/test_lib.py
@@ -0,0 +1,17 @@
+import os
+
+from clang.cindex import Config, conf, FUNCTION_LIST
+
+if "CLANG_LIBRARY_PATH" in os.environ:
+ Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
+
+import unittest
+
+
+class TestIndex(unittest.TestCase):
+ def test_functions_registered(self):
+ IGNORED = set(["_FuncPtr", "_name", "_handle"])
+ lib_functions = set(vars(conf.lib).keys())
+ registered_functions = set([item[0] for item in FUNCTION_LIST])
+ unregistered_functions = lib_functions - registered_functions - IGNORED
+ self.assertEqual(unregistered_functions, set())
|
@Endilll This PR adds the missing functions to |
You can see what this looks like in case of failure (missing library function) on the first CI run: https://github.com/llvm/llvm-project/actions/runs/15038723157/job/42265314399 |
✅ With the latest revision this PR passed the Python code formatter. |
PR title should mention somewhere that only used functions are registered. |
Adapted the title and description. |
Add a few library functions that were not previously registered to the
CDLL
object. The current behavior relies on the defaultrestype
to work.Add a test to check that all used library functions are properly registered.