[clang] [libclang/python] Do not rely on `ctypes`' `errcheck` (PR #105490)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 02:58:50 PDT 2024


================
@@ -2454,7 +2480,7 @@ def element_type(self):
         If accessed on a type that is not an array, complex, or vector type, an
         exception will be raised.
         """
-        result = conf.lib.clang_getElementType(self)
+        result = Type.from_result(conf.lib.clang_getElementType(self), (self,))
----------------
DeinAlptraum wrote:

I wonder if we should simplify this further. E.g. instead of passing the result of the library function call on `self`, and then `self` separately, should we pass just the callable and `self`, and then have the `from_result` function call the library function itself?
Would change e.g. the call marked here to `Type.from_result(conf.lib.clang_getElementType, self)`

https://github.com/llvm/llvm-project/pull/105490


More information about the cfe-commits mailing list