Index: bindings/python/clang/cindex.py =================================================================== --- bindings/python/clang/cindex.py +++ bindings/python/clang/cindex.py @@ -94,6 +94,9 @@ return cls(param) if isinstance(param, bytes): return cls(param) + if param is None: + # Support passing null to C functions expecting char arrays + return None raise TypeError("Cannot convert '{}' to '{}'".format(type(param).__name__, cls.__name__)) @staticmethod Index: bindings/python/tests/cindex/test_index.py =================================================================== --- bindings/python/tests/cindex/test_index.py +++ bindings/python/tests/cindex/test_index.py @@ -13,3 +13,5 @@ assert isinstance(index, Index) tu = index.parse(os.path.join(kInputsDir, 'hello.cpp')) assert isinstance(tu, TranslationUnit) + tu = index.parse(None, ['-c', os.path.join(kInputsDir, 'hello.cpp')]) + assert isinstance(tu, TranslationUnit)