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
56e9f494
Commit
56e9f494
authored
Jan 17, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved signature names for subclasses of pybind11::handle
parent
d0325bbd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
include/pybind11/cast.h
+5
-3
include/pybind11/common.h
+2
-0
include/pybind11/numpy.h
+4
-0
No files found.
include/pybind11/cast.h
View file @
56e9f494
...
...
@@ -467,6 +467,9 @@ protected:
holder_type
holder
;
};
template
<
typename
T
>
struct
handle_type_name
{
static
PYBIND11_DESCR
name
()
{
return
_
<
T
>
();
}
};
template
<>
struct
handle_type_name
<
bytes
>
{
static
PYBIND11_DESCR
name
()
{
return
_
(
PYBIND11_BYTES_NAME
);
}
};
template
<
typename
type
>
struct
type_caster
<
type
,
typename
std
::
enable_if
<
std
::
is_base_of
<
handle
,
type
>::
value
>::
type
>
{
public
:
...
...
@@ -477,10 +480,9 @@ public:
bool
load
(
PyObject
*
src
,
bool
/* convert */
)
{
value
=
type
(
src
,
true
);
return
value
.
check
();
}
static
PyObject
*
cast
(
const
handle
&
src
,
return_value_policy
/* policy */
,
PyObject
*
/* parent */
)
{
src
.
inc_ref
();
return
(
PyObject
*
)
src
.
ptr
();
src
.
inc_ref
();
return
(
PyObject
*
)
src
.
ptr
();
}
PYBIND11_TYPE_CASTER
(
type
,
_
<
type
>
());
PYBIND11_TYPE_CASTER
(
type
,
handle_type_name
<
type
>::
name
());
};
NAMESPACE_END
(
detail
)
...
...
include/pybind11/common.h
View file @
56e9f494
...
...
@@ -94,6 +94,7 @@
#define PYBIND11_LONG_CHECK(o) PyLong_Check(o)
#define PYBIND11_LONG_AS_LONGLONG(o) PyLong_AsLongLong(o)
#define PYBIND11_LONG_AS_UNSIGNED_LONGLONG(o) PyLong_AsUnsignedLongLong(o)
#define PYBIND11_BYTES_NAME "bytes"
#define PYBIND11_STRING_NAME "str"
#define PYBIND11_SLICE_OBJECT PyObject
#else
...
...
@@ -105,6 +106,7 @@
#define PYBIND11_LONG_CHECK(o) (PyInt_Check(o) || PyLong_Check(o))
#define PYBIND11_LONG_AS_LONGLONG(o) (PyInt_Check(o) ? (long long) PyLong_AsLong(o) : PyLong_AsLongLong(o))
#define PYBIND11_LONG_AS_UNSIGNED_LONGLONG(o) (PyInt_Check(o) ? (unsigned long long) PyLong_AsUnsignedLong(o) : PyLong_AsUnsignedLongLong(o))
#define PYBIND11_BYTES_NAME "str"
#define PYBIND11_STRING_NAME "unicode"
#define PYBIND11_SLICE_OBJECT PySliceObject
#endif
...
...
include/pybind11/numpy.h
View file @
56e9f494
...
...
@@ -150,6 +150,10 @@ DECL_FMT(std::complex<double>, NPY_CDOUBLE);
NAMESPACE_BEGIN
(
detail
)
template
<
typename
T
>
struct
handle_type_name
<
array_t
<
T
>>
{
static
PYBIND11_DESCR
name
()
{
return
_
(
"array["
)
+
type_caster
<
T
>::
name
()
+
_
(
"]"
);
}
};
template
<
typename
Func
,
typename
Return
,
typename
...
Args
>
struct
vectorize_helper
{
typename
std
::
remove_reference
<
Func
>::
type
f
;
...
...
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