We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e7bf777 commit 9a246c7Copy full SHA for 9a246c7
include/pybind11/cast.h
@@ -778,7 +778,7 @@ struct pyobject_caster {
778
// For Python 2, without this implicit conversion, Python code would
779
// need to be cluttered with six.ensure_text() or similar, only to be
780
// un-cluttered later after Python 2 support is dropped.
781
- if (std::is_same<T, str>::value && isinstance<bytes>(src)) {
+ if (constexpr_bool(std::is_same<T, str>::value) && isinstance<bytes>(src)) {
782
PyObject *str_from_bytes = PyUnicode_FromEncodedObject(src.ptr(), "utf-8", nullptr);
783
if (!str_from_bytes) throw error_already_set();
784
value = reinterpret_steal<type>(str_from_bytes);
0 commit comments