File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,11 @@ template <typename Type, typename Value> struct list_caster {
144
144
using value_conv = make_caster<Value>;
145
145
146
146
bool load (handle src, bool convert) {
147
- if (!isinstance<sequence>(src) || (!isinstance<bytes>(src) && isinstance<str>(src)))
147
+ if (!isinstance<sequence>(src) || (
148
+ #if PY_MAJOR_VERSION >= 3
149
+ !isinstance<bytes>(src) &&
150
+ #endif
151
+ isinstance<str>(src)))
148
152
return false ;
149
153
auto s = reinterpret_borrow<sequence>(src);
150
154
value.clear ();
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ def test_function_with_string_and_vector_string_arg():
247
247
248
248
def test_bytes_to_vector_uint8_t ():
249
249
"""Check if a bytes is implicitly converted to std::vector<uint8_t>, issue #1807"""
250
- assert m .func_with_vector_uint8_t_arg (b'abc' ) == 3
250
+ assert m .func_with_vector_uint8_t_arg ([ ord ( c ) for c in b'abc' ] ) == 3
251
251
with pytest .raises (TypeError ):
252
252
m .func_with_vector_uint8_t_arg ('stringval' )
253
253
You can’t perform that action at this time.
0 commit comments