Skip to content

Commit 9a246c7

Browse files
committed
One missed case, Python 2 only.
1 parent e7bf777 commit 9a246c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/pybind11/cast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ struct pyobject_caster {
778778
// For Python 2, without this implicit conversion, Python code would
779779
// need to be cluttered with six.ensure_text() or similar, only to be
780780
// un-cluttered later after Python 2 support is dropped.
781-
if (std::is_same<T, str>::value && isinstance<bytes>(src)) {
781+
if (constexpr_bool(std::is_same<T, str>::value) && isinstance<bytes>(src)) {
782782
PyObject *str_from_bytes = PyUnicode_FromEncodedObject(src.ptr(), "utf-8", nullptr);
783783
if (!str_from_bytes) throw error_already_set();
784784
value = reinterpret_steal<type>(str_from_bytes);

0 commit comments

Comments
 (0)