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
ccbe68b0
Commit
ccbe68b0
authored
Feb 04, 2019
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added binding delattr() -> PyObject_DelAttr analogous to hasattr()
parent
d1f64fa9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
include/pybind11/pytypes.h
+8
-1
No files found.
include/pybind11/pytypes.h
View file @
ccbe68b0
...
@@ -388,6 +388,14 @@ inline bool hasattr(handle obj, const char *name) {
...
@@ -388,6 +388,14 @@ inline bool hasattr(handle obj, const char *name) {
return
PyObject_HasAttrString
(
obj
.
ptr
(),
name
)
==
1
;
return
PyObject_HasAttrString
(
obj
.
ptr
(),
name
)
==
1
;
}
}
inline
void
delattr
(
handle
obj
,
handle
name
)
{
if
(
PyObject_DelAttr
(
obj
.
ptr
(),
name
.
ptr
())
!=
0
)
{
throw
error_already_set
();
}
}
inline
void
delattr
(
handle
obj
,
const
char
*
name
)
{
if
(
PyObject_DelAttrString
(
obj
.
ptr
(),
name
)
!=
0
)
{
throw
error_already_set
();
}
}
inline
object
getattr
(
handle
obj
,
handle
name
)
{
inline
object
getattr
(
handle
obj
,
handle
name
)
{
PyObject
*
result
=
PyObject_GetAttr
(
obj
.
ptr
(),
name
.
ptr
());
PyObject
*
result
=
PyObject_GetAttr
(
obj
.
ptr
(),
name
.
ptr
());
if
(
!
result
)
{
throw
error_already_set
();
}
if
(
!
result
)
{
throw
error_already_set
();
}
...
@@ -459,7 +467,6 @@ object object_or_cast(T &&o);
...
@@ -459,7 +467,6 @@ object object_or_cast(T &&o);
// Match a PyObject*, which we want to convert directly to handle via its converting constructor
// Match a PyObject*, which we want to convert directly to handle via its converting constructor
inline
handle
object_or_cast
(
PyObject
*
ptr
)
{
return
ptr
;
}
inline
handle
object_or_cast
(
PyObject
*
ptr
)
{
return
ptr
;
}
template
<
typename
Policy
>
template
<
typename
Policy
>
class
accessor
:
public
object_api
<
accessor
<
Policy
>>
{
class
accessor
:
public
object_api
<
accessor
<
Policy
>>
{
using
key_type
=
typename
Policy
::
key_type
;
using
key_type
=
typename
Policy
::
key_type
;
...
...
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