Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
4bf8b9b2
Commit
4bf8b9b2
authored
Oct 17, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typedef vector bool fix.
parent
1f9fa1c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-2
tests/run/cpp_stl_vector.pyx
tests/run/cpp_stl_vector.pyx
+18
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
4bf8b9b2
...
...
@@ -3486,8 +3486,8 @@ class CppClassType(CType):
# Here we pretend that the various methods return bool values
# (as the actual returned values are coercable to such, and
# we don't support call expressions as lvalues).
T
=
values
[
self
.
templates
[
0
]]
if
not
T
.
is_fused
and
T
.
empty_declaration_code
()
==
'bool'
:
T
=
values
.
get
(
self
.
templates
[
0
],
None
)
if
T
and
not
T
.
is_fused
and
T
.
empty_declaration_code
()
==
'bool'
:
for
bit_ref_returner
in
(
'at'
,
'back'
,
'front'
):
if
bit_ref_returner
in
specialized
.
scope
.
entries
:
specialized
.
scope
.
entries
[
bit_ref_returner
].
type
.
return_type
=
T
...
...
tests/run/cpp_stl_vector.pyx
View file @
4bf8b9b2
...
...
@@ -177,3 +177,21 @@ def test_bool_vector_get_set():
v
[
0
]
=
True
v
[
1
]
=
False
assert
<
object
>
v
==
[
True
,
False
,
True
,
True
,
True
]
ctypedef
vector
[
cbool
]
vector_bool
ctypedef
vector
[
int
]
vector_int
def
test_typedef_vector
(
L
):
"""
>>> test_typedef_vector([0, 1, True])
([0, 1, 1, 0, 1, 1], 0, [False, True, True, False, True, True], False)
"""
cdef
vector_int
vi
=
L
cdef
vector_int
vi2
=
vi
vi
.
insert
(
vi
.
begin
(),
vi2
.
begin
(),
vi2
.
end
())
cdef
vector_bool
vb
=
L
cdef
vector_bool
vb2
=
vb
vb
.
insert
(
vb
.
begin
(),
vb2
.
begin
(),
vb2
.
end
())
return
vi
,
vi
.
at
(
0
),
vb
,
vb
.
at
(
0
)
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