Skip to content

Commit

Permalink
Systematically change _ to const_name in pybind11_abseil, pybind1…
Browse files Browse the repository at this point in the history
…1_protobuf.

This is a functional no-op.

Note that `_` was deprecated already in Dec 2021 (pybind/pybind11#3423).

PiperOrigin-RevId: 575085924
  • Loading branch information
Ralf W. Grosse-Kunstleve authored and copybara-github committed Oct 20, 2023
1 parent 6c181d3 commit f6ff925
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pybind11_abseil/absl_casters.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ struct type_caster<absl::Span<T>> {
return *this;
}

static constexpr auto name = _("Span[") + make_caster<T>::name + _("]");
static constexpr auto name =
const_name("Span[") + make_caster<T>::name + const_name("]");

// We do not allow moving because 1) spans are super lightweight, so there's
// no advantage to moving and 2) the span cannot exist without the caster,
Expand Down
2 changes: 1 addition & 1 deletion pybind11_abseil/status_caster.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct type_caster<google::NoThrowStatus<StatusType>> {
template <>
struct type_caster<absl::Status> : public type_caster_base<absl::Status> {
public:
static constexpr auto name = _("None");
static constexpr auto name = const_name("None");
// Convert C++ -> Python.
static handle cast(const absl::Status* src, return_value_policy policy,
handle parent, bool throw_exception = true) {
Expand Down
5 changes: 3 additions & 2 deletions pybind11_abseil/statusor_caster.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ namespace detail {
template <typename PayloadType>
struct NoThrowStatusType<absl::StatusOr<PayloadType>> {
using NoThrowAbslStatus = type_caster_base<absl::Status>;
static constexpr auto name = _("Union[") + NoThrowAbslStatus::name + _(", ") +
make_caster<PayloadType>::name + _("]");
static constexpr auto name = const_name("Union[") + NoThrowAbslStatus::name +
const_name(", ") +
make_caster<PayloadType>::name + const_name("]");
};

// Convert absl::StatusOr<T>.
Expand Down

0 comments on commit f6ff925

Please sign in to comment.