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
ac0fde98
Commit
ac0fde98
authored
Oct 01, 2015
by
Wenzel Jakob
Browse files
don't throw an exception when python deallocates an object which still exists on the C++ side
parent
6d6fd099
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
include/pybind/cast.h
include/pybind/cast.h
+3
-0
include/pybind/pybind.h
include/pybind/pybind.h
+2
-0
include/pybind/pytypes.h
include/pybind/pytypes.h
+1
-1
No files found.
include/pybind/cast.h
View file @
ac0fde98
...
...
@@ -292,6 +292,9 @@ public:
PYBIND_TYPE_CASTER
(
void_type
,
"None"
);
};
template
<
>
class
type_caster
<
void
>
:
public
type_caster
<
void_type
>
{
};
template
<
>
class
type_caster
<
bool
>
{
public:
bool
load
(
PyObject
*
src
,
bool
)
{
...
...
include/pybind/pybind.h
View file @
ac0fde98
...
...
@@ -883,6 +883,8 @@ public:
inline
function
get_overload
(
const
void
*
this_ptr
,
const
char
*
name
)
{
handle
py_object
=
detail
::
get_object_handle
(
this_ptr
);
if
(
!
py_object
)
return
function
();
handle
type
=
py_object
.
get_type
();
auto
key
=
std
::
make_pair
(
type
.
ptr
(),
name
);
...
...
include/pybind/pytypes.h
View file @
ac0fde98
...
...
@@ -400,7 +400,7 @@ inline handle get_object_handle(const void *ptr) {
auto
instances
=
get_internals
().
registered_instances
;
auto
it
=
instances
.
find
(
ptr
);
if
(
it
==
instances
.
end
())
throw
std
::
runtime_error
(
"Internal error: could not acquire Python handle of a C++ object"
);
return
handle
(
);
return
it
->
second
;
}
...
...
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