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
18fb3e32
Commit
18fb3e32
authored
Apr 25, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a pybind11::none class
parent
9b880ba7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
include/pybind11/pytypes.h
+11
-3
No files found.
include/pybind11/pytypes.h
View file @
18fb3e32
...
...
@@ -212,7 +212,7 @@ private:
ssize_t
pos
=
0
;
};
inline
bool
iterable_c
heck
(
PyObject
*
obj
)
{
inline
bool
PyIterable_C
heck
(
PyObject
*
obj
)
{
PyObject
*
iter
=
PyObject_GetIter
(
obj
);
if
(
iter
)
{
Py_DECREF
(
iter
);
...
...
@@ -222,8 +222,10 @@ inline bool iterable_check(PyObject *obj) {
return
false
;
}
}
NAMESPACE_END
(
detail
)
inline
bool
PyNone_Check
(
PyObject
*
o
)
{
return
o
==
Py_None
;
}
NAMESPACE_END
(
detail
)
#define PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, CvtStmt) \
Name(const handle &h, bool borrowed) : Parent(h, borrowed) { CvtStmt; } \
...
...
@@ -261,7 +263,7 @@ private:
class
iterable
:
public
object
{
public
:
PYBIND11_OBJECT_DEFAULT
(
iterable
,
object
,
detail
::
iterable_c
heck
)
PYBIND11_OBJECT_DEFAULT
(
iterable
,
object
,
detail
::
PyIterable_C
heck
)
};
inline
detail
::
accessor
handle
::
operator
[](
handle
key
)
const
{
return
detail
::
accessor
(
ptr
(),
key
.
ptr
(),
false
);
}
...
...
@@ -319,6 +321,12 @@ public:
}
};
class
none
:
public
object
{
public
:
PYBIND11_OBJECT
(
none
,
object
,
detail
::
PyNone_Check
)
none
()
:
object
(
Py_None
,
true
)
{
}
};
class
bool_
:
public
object
{
public
:
PYBIND11_OBJECT_DEFAULT
(
bool_
,
object
,
PyBool_Check
)
...
...
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