Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121953277
external_module.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 15, 01:14
Size
554 B
Mime Type
text/x-c
Expires
Thu, Jul 17, 01:14 (2 d)
Engine
blob
Format
Raw Data
Handle
27374974
Attached To
R7581 SP4E Homework
external_module.cpp
View Options
#include <pybind11/pybind11.h>
namespace
py
=
pybind11
;
/* Simple test module/test class to check that the referenced internals data of external pybind11
* modules aren't preserved over a finalize/initialize.
*/
PYBIND11_MODULE
(
external_module
,
m
)
{
class
A
{
public
:
A
(
int
value
)
:
v
{
value
}
{};
int
v
;
};
py
::
class_
<
A
>
(
m
,
"A"
)
.
def
(
py
::
init
<
int
>
())
.
def_readwrite
(
"value"
,
&
A
::
v
);
m
.
def
(
"internals_at"
,
[]()
{
return
reinterpret_cast
<
uintptr_t
>
(
&
py
::
detail
::
get_internals
());
});
}
Event Timeline
Log In to Comment