================ @@ -663,6 +663,18 @@ bool PythonDictionary::Check(PyObject *py_obj) { return PyDict_Check(py_obj); } +bool PythonDictionary::HasKey(const llvm::Twine &key) const { + if (!IsValid()) + return false; + PythonString key_object(key.str().data()); ---------------- bulbazord wrote:
`key.str()` gives you a `std::string`, `PythonString`'s constructor takes a `StringRef`. If you pass it `key.str().data()` you're building a `StringRef` from a `const char *` which means you need to do some form of `strlen`. You can construct a `StringRef` from a `std::string` directly without a `strlen`. Assuming you don't change `key` to a `StringRef`, you can do this and save yourself from some complexity. ```suggestion PythonString key_object(key.str()); https://github.com/llvm/llvm-project/pull/71260 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits