From 84f9fb043e1f87686f272f1a28b59d17810c0798 Mon Sep 17 00:00:00 2001 From: Sergei Lebedev Date: Tue, 19 Nov 2019 10:51:53 -0800 Subject: [PATCH] Fixed a preprocessor guard in pybind11_absl.h tensorflow::StringPiece is an alias to std::string_view only if ABSL_USES_STD_STRING_VIEW is defined, otherwise we do need to register a type caster for it. PiperOrigin-RevId: 281329783 Change-Id: I34ec3ed52496d467666670cf691bebf18f30b3b1 --- tensorflow/python/lib/core/pybind11_absl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/lib/core/pybind11_absl.h b/tensorflow/python/lib/core/pybind11_absl.h index 09f9681fcdf..8a05d419654 100644 --- a/tensorflow/python/lib/core/pybind11_absl.h +++ b/tensorflow/python/lib/core/pybind11_absl.h @@ -19,7 +19,7 @@ limitations under the License. #include "pybind11/pybind11.h" #include "tensorflow/core/platform/stringpiece.h" -#if !defined(PYBIND11_CPP17) +#ifndef ABSL_USES_STD_STRING_VIEW namespace pybind11 { namespace detail { @@ -36,5 +36,5 @@ struct type_caster } // namespace detail } // namespace pybind11 -#endif // !defined(PYBIND11_CPP17) +#endif // ABSL_USES_STD_STRING_VIEW #endif // TENSORFLOW_PYTHON_LIB_CORE_PYBIND11_ABSL_H_