Skip to content

Prevent iterating over a TopologyCounter #3202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benjeffery
Copy link
Member

Fixes #1462

@benjeffery benjeffery force-pushed the no-iterate-topo-counter branch from 9a97abc to ddb4787 Compare June 9, 2025 00:04
@benjeffery
Copy link
Member Author

@hyanwong You're closer to this than I am - this seems like it should fix #1462. yes?

Copy link

codecov bot commented Jun 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.63%. Comparing base (e81ee40) to head (ddb4787).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3202   +/-   ##
=======================================
  Coverage   89.63%   89.63%           
=======================================
  Files          28       28           
  Lines       31978    31980    +2     
  Branches     5872     5872           
=======================================
+ Hits        28662    28664    +2     
  Misses       1886     1886           
  Partials     1430     1430           
Flag Coverage Δ
c-tests 86.66% <ø> (ø)
lwt-tests 80.38% <ø> (ø)
python-c-tests 88.18% <ø> (ø)
python-tests 98.86% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
python/tskit/combinatorics.py 99.36% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hyanwong
Copy link
Member

hyanwong commented Jun 9, 2025

I'm not sure. I think @daniel-goldstein suggested actually implementing the iterator in #1462 (comment) rather than making it bomb out.

It should be easy, it's just choosing either 1 or 2 from his list. Do you have a preference @benjeffery ?

@benjeffery
Copy link
Member Author

Is what I've done here correct in that iterating .topologies makes sense?

@jeromekelleher
Copy link
Member

Let's take the simple path here and raise an error rather than try to implement the right thing

@benjeffery
Copy link
Member Author

Let's take the simple path here and raise an error rather than try to implement the right thing

Yes, my focus was on preventing the easy to trigger infinite loop.

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.

iterating over count_topologies method never stops
3 participants