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

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 27 13:12:29 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,))
----------------
Endilll wrote:

I took another look at this particular thing, even though it's out scope of this PR. Apparently, the sole purpose of this dance is to make sure that `TranslationUnit` doesn't die before `Type` or `Cursor`. I have a feeling we can do better (read "less confusing"), but I don't have a concrete proposal yet.

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


More information about the cfe-commits mailing list