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
a76ed42c
Commit
a76ed42c
authored
Feb 14, 2017
by
Dean Moldovan
Committed by
Wenzel Jakob
Feb 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sequence_item reference leak (#660)
parent
5e92b3e6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
include/pybind11/pytypes.h
+2
-2
No files found.
include/pybind11/pytypes.h
View file @
a76ed42c
...
@@ -254,7 +254,7 @@ public:
...
@@ -254,7 +254,7 @@ public:
.. code-block:: cpp
.. code-block:: cpp
PyObject *
result = PySequence
_GetItem(obj, index);
PyObject *
p = PyList
_GetItem(obj, index);
py::object o = reinterpret_borrow<py::object>(p);
py::object o = reinterpret_borrow<py::object>(p);
// or
// or
py::tuple t = reinterpret_borrow<py::tuple>(p); // <-- `p` must be already be a `tuple`
py::tuple t = reinterpret_borrow<py::tuple>(p); // <-- `p` must be already be a `tuple`
...
@@ -453,7 +453,7 @@ struct sequence_item {
...
@@ -453,7 +453,7 @@ struct sequence_item {
static
object
get
(
handle
obj
,
size_t
index
)
{
static
object
get
(
handle
obj
,
size_t
index
)
{
PyObject
*
result
=
PySequence_GetItem
(
obj
.
ptr
(),
static_cast
<
ssize_t
>
(
index
));
PyObject
*
result
=
PySequence_GetItem
(
obj
.
ptr
(),
static_cast
<
ssize_t
>
(
index
));
if
(
!
result
)
{
throw
error_already_set
();
}
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
)
{
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