Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
a76ed42c
Commit
a76ed42c
authored
Feb 14, 2017
by
Dean Moldovan
Committed by
Wenzel Jakob
Feb 14, 2017
Browse files
Fix sequence_item reference leak (#660)
parent
5e92b3e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
include/pybind11/pytypes.h
include/pybind11/pytypes.h
+2
-2
No files found.
include/pybind11/pytypes.h
View file @
a76ed42c
...
...
@@ -254,7 +254,7 @@ public:
.. code-block:: cpp
PyObject *
result = PySequence
_GetItem(obj, index);
PyObject *
p = PyList
_GetItem(obj, index);
py::object o = reinterpret_borrow<py::object>(p);
// or
py::tuple t = reinterpret_borrow<py::tuple>(p); // <-- `p` must be already be a `tuple`
...
...
@@ -453,7 +453,7 @@ struct sequence_item {
static
object
get
(
handle
obj
,
size_t
index
)
{
PyObject
*
result
=
PySequence_GetItem
(
obj
.
ptr
(),
static_cast
<
ssize_t
>
(
index
));
if
(
!
result
)
{
throw
error_already_set
();
}
return
reinterpret_
borrow
<
object
>
(
result
);
return
reinterpret_
steal
<
object
>
(
result
);
}
static
void
set
(
handle
obj
,
size_t
index
,
handle
val
)
{
...
...
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