Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
97b34638
Commit
97b34638
authored
Dec 03, 2020
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restoring original behavior, only leaving the new lambda function in test_stl.cpp
parent
011663df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
include/pybind11/stl.h
+4
-0
tests/test_stl.py
+5
-5
No files found.
include/pybind11/stl.h
View file @
97b34638
...
...
@@ -144,11 +144,15 @@ template <typename Type, typename Value> struct list_caster {
using
value_conv
=
make_caster
<
Value
>
;
bool
load
(
handle
src
,
bool
convert
)
{
#if 1
if
(
!
isinstance
<
sequence
>
(
src
)
||
isinstance
<
str
>
(
src
))
#else
if
(
!
isinstance
<
sequence
>
(
src
)
||
(
#if PY_MAJOR_VERSION >= 3
!
isinstance
<
bytes
>
(
src
)
&&
#endif
isinstance
<
str
>
(
src
)))
#endif
return
false
;
auto
s
=
reinterpret_borrow
<
sequence
>
(
src
);
value
.
clear
();
...
...
tests/test_stl.py
View file @
97b34638
...
...
@@ -245,11 +245,11 @@ def test_function_with_string_and_vector_string_arg():
assert
m
.
func_with_string_or_vector_string_arg_overload
(
"A"
)
==
3
def
test_bytes_to_vector_uint8_t
():
"""Check if a bytes is implicitly converted to std::vector<uint8_t>, issue #1807"""
assert
m
.
func_with_vector_uint8_t_arg
([
ord
(
c
)
for
c
in
b
'abc'
])
==
3
with
pytest
.
raises
(
TypeError
):
m
.
func_with_vector_uint8_t_arg
(
'stringval'
)
#
def test_bytes_to_vector_uint8_t():
#
"""Check if a bytes is implicitly converted to std::vector<uint8_t>, issue #1807"""
#
assert m.func_with_vector_uint8_t_arg([ord(c) for c in b'abc']) == 3
#
with pytest.raises(TypeError):
#
m.func_with_vector_uint8_t_arg('stringval')
def
test_stl_ownership
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment