Skip to content

Commit

Permalink
Raise exception if infinite_sites is called during a simulation. (#820)
Browse files Browse the repository at this point in the history
Closes #769
  • Loading branch information
molpopgen committed Oct 15, 2021
1 parent 95a3601 commit 4011bed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/misc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Behavior changes
This change makes the timings consistent with all other events and also makes
certain operations easier/feasible.
{pr}`809`
* Calling {func}`fwdpy11.infinite_sites` during a simulation now raises `RuntimeError`.
{pr}`820`
{issue}`769`

New features

Expand Down
5 changes: 5 additions & 0 deletions fwdpy11/src/ts/infinite_sites.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ init_infinite_sites(py::module& m)
"infinite_sites",
[](const fwdpy11::GSLrng_t& rng, fwdpy11::Population& pop,
const double mu) -> unsigned {
if (pop.is_simulating)
{
throw std::runtime_error(
"infinite_sites cannot be called during a simulation");
}
if (mu <= 0.0)
{
return 0u;
Expand Down

0 comments on commit 4011bed

Please sign in to comment.