================ @@ -200,13 +236,16 @@ class _CXString(Structure): _fields_ = [("spelling", c_char_p), ("free", c_int)] - def __del__(self): + def __del__(self) -> None: conf.lib.clang_disposeString(self) @staticmethod - def from_result(res, fn=None, args=None): + def from_result(res: _CXString, fn: Any = None, args: Any = None) -> str: assert isinstance(res, _CXString) - return conf.lib.clang_getCString(res) + pystr: str | None = conf.lib.clang_getCString(res) + if pystr is None: + return "" + return pystr ---------------- DeinAlptraum wrote:
The interface changes, isn't that a breaking change in every case? I.e. if you were checking for empty results before by doing `is None`, that doesn't work anymore. You would now have to change that to `== ""`. I've added a breaking change note for this, but happy to remove this again if I'm missing something here. https://github.com/llvm/llvm-project/pull/98745 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits