mirror of
https://github.com/pybind/pybind11.git
synced 2026-06-06 15:54:12 +00:00
Support keep_alive where nurse may be None
For example keep_alive<0,1>() should work where the return value may sometimes be None. At present a "Could not allocate weak reference!" exception is thrown. Update documentation to clarify behaviour of keep_alive when nurse is None or does not support weak references.
This commit is contained in:
@@ -31,6 +31,7 @@ if True:
|
||||
gc.collect()
|
||||
print(p)
|
||||
p = None
|
||||
|
||||
gc.collect()
|
||||
print("")
|
||||
|
||||
@@ -41,6 +42,26 @@ if True:
|
||||
print(p)
|
||||
p = None
|
||||
|
||||
gc.collect()
|
||||
print("")
|
||||
|
||||
if True:
|
||||
p = Parent()
|
||||
p.returnNullChildKeepAliveChild()
|
||||
gc.collect()
|
||||
print(p)
|
||||
p = None
|
||||
|
||||
gc.collect()
|
||||
print("")
|
||||
|
||||
if True:
|
||||
p = Parent()
|
||||
p.returnNullChildKeepAliveParent()
|
||||
gc.collect()
|
||||
print(p)
|
||||
p = None
|
||||
|
||||
gc.collect()
|
||||
print("")
|
||||
print("Terminating..")
|
||||
|
||||
Reference in New Issue
Block a user