Skip to content

Conversation

@benjeffery
Copy link
Member

@benjeffery benjeffery commented Nov 23, 2020

Description

The tskit.LightweightTableCollection and tskit.TableCollection were not taking copies of arrays, leading to lifecycle errors where the array could be deallocated.

Fixes #1025

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

@codecov
Copy link

codecov bot commented Nov 23, 2020

Codecov Report

Merging #1029 (8b464a4) into main (cc50d28) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1029   +/-   ##
=======================================
  Coverage   93.69%   93.69%           
=======================================
  Files          26       26           
  Lines       20846    20848    +2     
  Branches      859      859           
=======================================
+ Hits        19531    19533    +2     
  Misses       1277     1277           
  Partials       38       38           
Flag Coverage Δ
c-tests 92.49% <ø> (ø)
lwt-tests 93.58% <100.00%> (+0.01%) ⬆️
python-c-tests 94.86% <100.00%> (+<0.01%) ⬆️
python-tests 98.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/lwt_interface/tskit_lwt_interface.h 94.92% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc50d28...8b464a4. Read the comment docs.

@AdminBot-tskit
Copy link
Collaborator

📖 Docs for this PR can be previewed here

@benjeffery benjeffery force-pushed the fix-asdict branch 3 times, most recently from 74f5be3 to be2c27f Compare November 23, 2020 14:12
@benjeffery benjeffery marked this pull request as ready for review November 23, 2020 14:13
@benjeffery
Copy link
Member Author

I've also modified the tests to use a fixture, this reduces the test time to 25% of what it was. This helps in the stress test which I have run to 2000 iterations without seeing any leaks.

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

lwt = lwt_module.LightweightTableCollection()
lwt_dict = lwt.asdict()
del lwt
print(lwt_dict)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray print

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dammit! So close!

@mergify mergify bot merged commit e5ef2d5 into tskit-dev:main Nov 23, 2020
@benjeffery benjeffery deleted the fix-asdict branch November 23, 2020 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LWT dict has bad data if LWT object is deleted.

3 participants