functions: Add doc on incorrect argument index (#2979)

test_call_policies: Explicitly check free-functions and static methods
This commit is contained in:
Eric Cousineau
2021-05-06 10:13:30 -04:00
committed by GitHub
parent 417fd120cc
commit b6ec0e950c
3 changed files with 40 additions and 1 deletions

View File

@@ -182,6 +182,9 @@ relies on the ability to create a *weak reference* to the nurse object. When
the nurse object is not a pybind11-registered type and does not support weak
references, an exception will be thrown.
If you use an incorrect argument index, you will get a ``RuntimeError`` saying
``Could not activate keep_alive!``. You should review the indices you're using.
Consider the following example: here, the binding code for a list append
operation ties the lifetime of the newly added element to the underlying
container: