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