[cfe-commits] [PATCH 1/4] [clang.py] Store reference to TranslationUnit in Cursor and Type

Gregory Szorc gregory.szorc at gmail.com
Sat May 12 22:20:09 PDT 2012


This patch stores a reference to the underlying TranslationUnit in
Cursor and Type instances. We want to keep this reference so garbage
collection doesn't collect the TranslationUnit instance, which would
free the backing memory and possibly cause a segfault if the Cursor or
Type instance makes a C API call against a dead TU.

Other types in the module (like File) also need this treatment. Those
will be addressed in a later patch.

---
 bindings/python/clang/cindex.py             |   46 ++++++++++++++++++++++++++-
 bindings/python/tests/cindex/test_cursor.py |    3 ++
 bindings/python/tests/cindex/test_type.py   |    1 +
 3 files changed, 49 insertions(+), 1 deletion(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-clang.py-Store-reference-to-TranslationUnit-in-Curso.patch
Type: text/x-patch
Size: 6193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120512/dda6cf15/attachment.bin>


More information about the cfe-commits mailing list