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
c8e37b58
Commit
c8e37b58
authored
Dec 04, 2020
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renaming instance::owned to aaa_owned, to pin-point where it is used
parent
e639c3a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
include/pybind11/cast.h
+7
-7
include/pybind11/detail/class.h
+2
-2
include/pybind11/detail/common.h
+1
-1
include/pybind11/pybind11.h
+3
-3
No files found.
include/pybind11/cast.h
View file @
c8e37b58
...
...
@@ -392,7 +392,7 @@ PYBIND11_NOINLINE inline void instance::allocate_layout() {
#endif
nonsimple
.
status
=
reinterpret_cast
<
uint8_t
*>
(
&
nonsimple
.
values_and_holders
[
flags_at
]);
}
owned
=
true
;
aaa_
owned
=
true
;
}
PYBIND11_NOINLINE
inline
void
instance
::
deallocate_layout
()
{
...
...
@@ -518,20 +518,20 @@ public:
auto
inst
=
reinterpret_steal
<
object
>
(
make_new_instance
(
tinfo
->
type
));
auto
wrapper
=
reinterpret_cast
<
instance
*>
(
inst
.
ptr
());
wrapper
->
owned
=
false
;
wrapper
->
aaa_
owned
=
false
;
void
*&
valueptr
=
values_and_holders
(
wrapper
).
begin
()
->
xxx_value_ptr
<
void
>
();
// holder_type not available here.
switch
(
policy
)
{
case
return_value_policy
:
:
automatic
:
case
return_value_policy
:
:
take_ownership
:
valueptr
=
src
;
wrapper
->
owned
=
true
;
wrapper
->
aaa_
owned
=
true
;
break
;
case
return_value_policy
:
:
automatic_reference
:
case
return_value_policy
:
:
reference
:
valueptr
=
src
;
wrapper
->
owned
=
false
;
wrapper
->
aaa_
owned
=
false
;
break
;
case
return_value_policy
:
:
copy
:
...
...
@@ -548,7 +548,7 @@ public:
type_name
+
" is non-copyable!"
);
#endif
}
wrapper
->
owned
=
true
;
wrapper
->
aaa_
owned
=
true
;
break
;
case
return_value_policy
:
:
move
:
...
...
@@ -568,12 +568,12 @@ public:
type_name
+
" is neither movable nor copyable!"
);
#endif
}
wrapper
->
owned
=
true
;
wrapper
->
aaa_
owned
=
true
;
break
;
case
return_value_policy
:
:
reference_internal
:
valueptr
=
src
;
wrapper
->
owned
=
false
;
wrapper
->
aaa_
owned
=
false
;
keep_alive_impl
(
inst
,
parent
);
break
;
...
...
include/pybind11/detail/class.h
View file @
c8e37b58
...
...
@@ -340,7 +340,7 @@ inline PyObject *make_new_instance(PyTypeObject *type) {
// Allocate the value/holder internals:
inst
->
allocate_layout
();
inst
->
owned
=
true
;
inst
->
aaa_
owned
=
true
;
return
self
;
}
...
...
@@ -398,7 +398,7 @@ inline void clear_instance(PyObject *self) {
if
(
v_h
.
instance_registered
()
&&
!
deregister_instance
(
instance
,
v_h
.
xxx_value_ptr
<
void
>
(),
v_h
.
type
))
pybind11_fail
(
"pybind11_object_dealloc(): Tried to deallocate unregistered instance!"
);
if
(
instance
->
owned
||
v_h
.
holder_constructed
())
if
(
instance
->
aaa_
owned
||
v_h
.
holder_constructed
())
v_h
.
type
->
dealloc
(
v_h
);
}
}
...
...
include/pybind11/detail/common.h
View file @
c8e37b58
...
...
@@ -426,7 +426,7 @@ struct instance {
/// Weak references
PyObject
*
weakrefs
;
/// If true, the pointer is owned which means we're free to manage it with a holder.
bool
owned
:
1
;
bool
aaa_
owned
:
1
;
/**
* An instance has two possible value/holder layouts.
*
...
...
include/pybind11/pybind11.h
View file @
c8e37b58
...
...
@@ -1464,7 +1464,7 @@ private:
}
}
catch
(
const
std
::
bad_weak_ptr
&
)
{}
if
(
!
v_h
.
holder_constructed
()
&&
inst
->
owned
)
{
if
(
!
v_h
.
holder_constructed
()
&&
inst
->
aaa_
owned
)
{
new
(
std
::
addressof
(
v_h
.
xxx_holder
<
holder_type
>
()))
holder_type
(
v_h
.
xxx_value_ptr
<
type
>
());
// init_holder
v_h
.
set_holder_constructed
();
}
...
...
@@ -1486,7 +1486,7 @@ private:
if
(
holder_ptr
)
{
init_holder_from_existing
(
v_h
,
holder_ptr
,
std
::
is_copy_constructible
<
holder_type
>
());
v_h
.
set_holder_constructed
();
}
else
if
(
inst
->
owned
||
detail
::
always_construct_holder
<
holder_type
>::
value
)
{
}
else
if
(
inst
->
aaa_
owned
||
detail
::
always_construct_holder
<
holder_type
>::
value
)
{
new
(
std
::
addressof
(
v_h
.
xxx_holder
<
holder_type
>
()))
holder_type
(
v_h
.
xxx_value_ptr
<
type
>
());
// init_holder
v_h
.
set_holder_constructed
();
}
...
...
@@ -1495,7 +1495,7 @@ private:
/// Performs instance initialization including constructing a holder and registering the known
/// instance. Should be called as soon as the `type` value_ptr is set for an instance. Takes an
/// optional pointer to an existing holder to use; if not specified and the instance is
/// `.owned`, a new holder will be constructed to manage the value pointer.
/// `.
aaa_
owned`, a new holder will be constructed to manage the value pointer.
static
void
init_instance
(
detail
::
instance
*
inst
,
const
void
*
holder_ptr
)
{
auto
v_h
=
inst
->
get_value_and_holder
(
detail
::
get_type_info
(
typeid
(
type
)));
if
(
!
v_h
.
instance_registered
())
{
...
...
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