Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
4b279327
Commit
4b279327
authored
Dec 18, 2015
by
Wenzel Jakob
Browse files
stl.h bugfix for std::set, misc. cleanups
parent
dbfaf370
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
include/pybind11/stl.h
include/pybind11/stl.h
+5
-8
No files found.
include/pybind11/stl.h
View file @
4b279327
...
...
@@ -51,7 +51,7 @@ public:
Py_DECREF
(
list
);
return
nullptr
;
}
PyList_S
etItem
(
list
,
index
++
,
value_
);
PyList_S
ET_ITEM
(
list
,
index
++
,
value_
);
// steals a reference
}
return
list
;
}
...
...
@@ -80,15 +80,12 @@ public:
PyObject
*
set
=
PySet_New
(
nullptr
);
for
(
auto
const
&
value
:
src
)
{
PyObject
*
value_
=
value_conv
::
cast
(
value
,
policy
,
parent
);
if
(
!
value_
)
{
Py_DECREF
(
set
);
return
nullptr
;
}
if
(
PySet_Add
(
set
,
value
)
!=
0
)
{
Py_DECREF
(
value
);
if
(
!
value_
||
PySet_Add
(
set
,
value_
)
!=
0
)
{
Py_XDECREF
(
value_
);
Py_DECREF
(
set
);
return
nullptr
;
}
Py_DECREF
(
value_
);
}
return
set
;
}
...
...
@@ -123,7 +120,7 @@ public:
for
(
auto
const
&
kv
:
src
)
{
PyObject
*
key
=
key_conv
::
cast
(
kv
.
first
,
policy
,
parent
);
PyObject
*
value
=
value_conv
::
cast
(
kv
.
second
,
policy
,
parent
);
if
(
!
key
||
!
value
||
PyDict_SetItem
(
dict
,
key
,
value
)
<
0
)
{
if
(
!
key
||
!
value
||
PyDict_SetItem
(
dict
,
key
,
value
)
!=
0
)
{
Py_XDECREF
(
key
);
Py_XDECREF
(
value
);
Py_DECREF
(
dict
);
...
...
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