mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
Unwrapping an array of structs is meant to take the ownership share for these structs, and thus to clear them. This means that the destructor of Python wrappers for structs must handle the case where they no longer have the ownership of a struct value: they didn't so far, which triggered crashes. TN: UA05-027
17 lines
362 B
Python
17 lines
362 B
Python
import libfoolang as lfl
|
|
from libfoolang import ExampleHolder as EH
|
|
|
|
|
|
ctx = lfl.AnalysisContext()
|
|
u = ctx.get_from_buffer("test", "example")
|
|
n = u.root
|
|
print(f"p_example_holder = {n.p_example_holders}")
|
|
for a in [
|
|
[],
|
|
[EH([])],
|
|
[EH([n])],
|
|
[EH([n, n])],
|
|
[EH([n, n]), EH([n]), EH([])],
|
|
]:
|
|
print(f"p_identity({a}) = {u.root.p_identity(a)}")
|