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
f53e300f
Commit
f53e300f
authored
Jun 30, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc updates
parent
09e22b4a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
docs/advanced.rst
+7
-8
No files found.
docs/advanced.rst
View file @
f53e300f
...
@@ -526,14 +526,13 @@ The following example snippet shows a use case of the
...
@@ -526,14 +526,13 @@ The following example snippet shows a use case of the
non-determinism and segmentation faults, hence it is worth spending the
non-determinism and segmentation faults, hence it is worth spending the
time to understand all the different options in the table above.
time to understand all the different options in the table above.
.. warning::
It is worth highlighting one common issue where a method (e.g. a getter)
returns a reference (or pointer) to the first attribute of a class. In this
pybind11 tries to eliminate duplicate addresses by returning the same reference object.
case, the class and attribute will be located at the same address in
If two addresses are the same, though they do not point to the same object semantically,
memory, which pybind11 will recongnize and return the parent instance
this may cause unexpected behaviour. An explicit policy should be used instead of
instead of creating a new Python object that represents the attribute.
relying on `automatic`.
Here, the :enum:`return_value_policy::reference_internal` policy should be
A common example is a reference to the first member of a class which has the same memory
used rather than relying on the automatic one.
location as its owning class.
.. note::
.. note::
...
...
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