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
d0325bbd
Commit
d0325bbd
authored
Jan 17, 2016
by
Wenzel Jakob
Browse files
switched a few admissible cases from PyTuple_Set/GetItem -> PyTuple_SET/GET_ITEM
parent
27e8e106
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
include/pybind11/cast.h
include/pybind11/cast.h
+7
-7
No files found.
include/pybind11/cast.h
View file @
d0325bbd
...
...
@@ -320,9 +320,9 @@ public:
bool
load
(
PyObject
*
src
,
bool
convert
)
{
if
(
!
PyTuple_Check
(
src
)
||
PyTuple_Size
(
src
)
!=
2
)
return
false
;
if
(
!
first
.
load
(
PyTuple_G
etItem
(
src
,
0
),
convert
))
if
(
!
first
.
load
(
PyTuple_G
ET_ITEM
(
src
,
0
),
convert
))
return
false
;
return
second
.
load
(
PyTuple_G
etItem
(
src
,
1
),
convert
);
return
second
.
load
(
PyTuple_G
ET_ITEM
(
src
,
1
),
convert
);
}
static
PyObject
*
cast
(
const
type
&
src
,
return_value_policy
policy
,
PyObject
*
parent
)
{
...
...
@@ -333,8 +333,8 @@ public:
PyObject
*
tuple
=
PyTuple_New
(
2
);
if
(
!
tuple
)
return
nullptr
;
PyTuple_S
etItem
(
tuple
,
0
,
o1
.
release
());
PyTuple_S
etItem
(
tuple
,
1
,
o2
.
release
());
PyTuple_S
ET_ITEM
(
tuple
,
0
,
o1
.
release
());
PyTuple_S
ET_ITEM
(
tuple
,
1
,
o2
.
release
());
return
tuple
;
}
...
...
@@ -422,7 +422,7 @@ protected:
return
nullptr
;
int
counter
=
0
;
for
(
auto
&
result
:
results
)
PyTuple_S
etItem
(
tuple
,
counter
++
,
result
.
release
());
PyTuple_S
ET_ITEM
(
tuple
,
counter
++
,
result
.
release
());
return
tuple
;
}
...
...
@@ -512,10 +512,10 @@ template <typename... Args> inline object handle::call(Args&&... args_) const {
throw
cast_error
(
"handle::call(): unable to convert input arguments to Python objects"
);
object
tuple
(
PyTuple_New
(
size
),
false
);
if
(
!
tuple
)
throw
cast_error
(
"handle::call(): unable to
convert input arguments to Python objects
"
);
throw
cast_error
(
"handle::call(): unable to
allocate tuple
"
);
int
counter
=
0
;
for
(
auto
&
result
:
args
)
PyTuple_S
etItem
(
tuple
.
ptr
(),
counter
++
,
result
.
release
());
PyTuple_S
ET_ITEM
(
tuple
.
ptr
(),
counter
++
,
result
.
release
());
PyObject
*
result
=
PyObject_CallObject
(
m_ptr
,
tuple
.
ptr
());
if
(
result
==
nullptr
&&
PyErr_Occurred
())
throw
error_already_set
();
...
...
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