This PR adds new functions to clone a P7_TOPHITS, namely p7_domain_Copy, p7_hit_Copy and p7_tophits_Clone, which follow the copy/clone semantics of the rest of the code.
You may not have immediate use for it in HMMER, but I definitely need them for PyHMMER (where I actually implemented them, but they have their place in the upstream code). Basically, since the p7_tophits_merge function effectively consumes its second argument, this makes it unsound to use in Python, because reference counting means that several references may still exist to the second top hits. Copying the hits before merging solves the issue because the original object is then untouched.
Hi !
This PR adds new functions to clone a
P7_TOPHITS
, namelyp7_domain_Copy
,p7_hit_Copy
andp7_tophits_Clone
, which follow the copy/clone semantics of the rest of the code.You may not have immediate use for it in HMMER, but I definitely need them for PyHMMER (where I actually implemented them, but they have their place in the upstream code). Basically, since the
p7_tophits_merge
function effectively consumes its second argument, this makes it unsound to use in Python, because reference counting means that several references may still exist to the second top hits. Copying the hits before merging solves the issue because the original object is then untouched.