Skip to content

Commit 97b3463

Browse files
committed
restoring original behavior, only leaving the new lambda function in test_stl.cpp
1 parent 011663d commit 97b3463

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

include/pybind11/stl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,15 @@ template <typename Type, typename Value> struct list_caster {
144144
using value_conv = make_caster<Value>;
145145

146146
bool load(handle src, bool convert) {
147+
#if 1
148+
if (!isinstance<sequence>(src) || isinstance<str>(src))
149+
#else
147150
if (!isinstance<sequence>(src) || (
148151
#if PY_MAJOR_VERSION >= 3
149152
!isinstance<bytes>(src) &&
150153
#endif
151154
isinstance<str>(src)))
155+
#endif
152156
return false;
153157
auto s = reinterpret_borrow<sequence>(src);
154158
value.clear();

tests/test_stl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ def test_function_with_string_and_vector_string_arg():
245245
assert m.func_with_string_or_vector_string_arg_overload("A") == 3
246246

247247

248-
def test_bytes_to_vector_uint8_t():
249-
"""Check if a bytes is implicitly converted to std::vector<uint8_t>, issue #1807"""
250-
assert m.func_with_vector_uint8_t_arg([ord(c) for c in b'abc']) == 3
251-
with pytest.raises(TypeError):
252-
m.func_with_vector_uint8_t_arg('stringval')
248+
#def test_bytes_to_vector_uint8_t():
249+
# """Check if a bytes is implicitly converted to std::vector<uint8_t>, issue #1807"""
250+
# assert m.func_with_vector_uint8_t_arg([ord(c) for c in b'abc']) == 3
251+
# with pytest.raises(TypeError):
252+
# m.func_with_vector_uint8_t_arg('stringval')
253253

254254

255255
def test_stl_ownership():

0 commit comments

Comments
 (0)