================ @@ -314,6 +316,8 @@ def is_in_system_header(self): return conf.lib.clang_Location_isInSystemHeader(self) # type: ignore [no-any-return] def __eq__(self, other): + if not isinstance(other, SourceLocation): + return False ---------------- DeinAlptraum wrote:
Currently, the `__eq__` operators in the Python bindings error out if you pass in a non-conforming object (say, `some_location == "hello"`. The `__eq__` is expected to deal correctly with all types of objects, so this leads to a typing error if we were to annotate it as `def __eq__(self, other: SourceLocation):` https://github.com/llvm/llvm-project/pull/138074 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits