python: make sere twa::acc() survives its automaton

Fixes #468.

* python/spot/__init__.py: Add wrapper around twa::acc() and
twa::get_acceptance() to store the automaton into the acceptance
proxy, therefore ensuring that the automaton survives that proxy.
* tests/python/setacc.py: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2021-07-12 15:27:07 +02:00
parent b767411a82
commit d019ea61fe
2 changed files with 35 additions and 1 deletions

View file

@ -96,3 +96,13 @@ except RuntimeError as e:
pass
else:
raise e
# issue #468
from gc import collect
acc = spot.translate('a').acc()
collect()
assert acc == spot.acc_cond('Inf(0)')
acc = spot.translate('b').get_acceptance()
collect()
assert acc == spot.acc_code('Inf(0)')