variations() not clone-safe
Stumbled upon when developing a solution for #25 (closed):
If you open a file, get the AO, clone the AO and call variations()
on the clone, it's all good.
When you close the file, open another file, and then call variations()
on the clone of the old object, Python itself (not just the script) crashes with a seg fault:
import yoda
aos = { }
for step in range(2):
aos_in = yoda.read("file2.yoda.gz" if step else "file1.yoda.gz")
for aopath, ao in aos_in.items():
if aopath not in aos:
aos[aopath] = ao.clone()
if 'Scatter' in aos[aopath].type():
print ('with file open:', aos[aopath].variations())
else:
if 'Scatter' in aos[aopath].type():
## aos[aopath] by itself seems fine, but
print ('with file closed:', aos[aopath].variations()) ## seg faults
That should work though, no?