Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pybind11_protobuf/check_unknown_fields.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool MessageMayContainExtensionsRecursive(const ::google::protobuf::Descriptor*
bool MessageMayContainExtensionsMemoized(const ::google::protobuf::Descriptor* descriptor) {
static auto* memoized = new MayContainExtensionsMap();
static absl::Mutex lock;
absl::MutexLock l(&lock);
absl::MutexLock l(lock);
return MessageMayContainExtensionsRecursive(descriptor, memoized);
}

Expand Down Expand Up @@ -181,7 +181,7 @@ void AllowUnknownFieldsFor(absl::string_view top_message_descriptor_full_name,
unknown_field_parent_message_fqn));
}

absl::optional<std::string> CheckRecursively(
std::optional<std::string> CheckRecursively(
const ::google::protobuf::python::PyProto_API* py_proto_api,
const ::google::protobuf::Message* message) {
const auto* root_descriptor = message->GetDescriptor();
Expand Down
9 changes: 5 additions & 4 deletions pybind11_protobuf/proto_cast_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool IsImportError(py::error_already_set& e) {

// Resolves a sequence of python attrs starting from obj.
// If any does not exist, returns nullopt.
absl::optional<py::object> ResolveAttrs(
std::optional<pybind11::object> ResolveAttrs(
py::handle obj, std::initializer_list<const char*> names) {
py::object tmp;
for (const char* name : names) {
Expand All @@ -101,7 +101,8 @@ absl::optional<py::object> ResolveAttrs(
// Unfortunately the metaclass mechanism used by protos (fast_cpp_protos) does
// not leave __dict__ in a state where the default getattr functions find the
// base class methods, so we resolve those using MRO.
absl::optional<py::object> ResolveAttrMRO(py::handle obj, const char* name) {
std::optional<pybind11::object> ResolveAttrMRO(py::handle obj,
const char* name) {
PyObject* attr;
const auto* t = Py_TYPE(obj.ptr());
if (!t->tp_mro) {
Expand Down Expand Up @@ -135,7 +136,7 @@ absl::optional<py::object> ResolveAttrMRO(py::handle obj, const char* name) {
return absl::nullopt;
}

absl::optional<std::string> CastToOptionalString(py::handle src) {
std::optional<std::string> CastToOptionalString(py::handle src) {
// Avoid pybind11::cast because it throws an exeption.
pybind11::detail::make_caster<std::string> c;
if (c.load(src, false)) {
Expand Down Expand Up @@ -492,7 +493,7 @@ const Message* PyProtoGetCppMessagePointer(py::handle src) {
#endif
}

absl::optional<std::string> PyProtoDescriptorFullName(py::handle py_proto) {
std::optional<std::string> PyProtoDescriptorFullName(py::handle py_proto) {
assert(PyGILState_Check());
auto py_full_name = ResolveAttrs(py_proto, {"DESCRIPTOR", "full_name"});
if (py_full_name) {
Expand Down
Loading