# statsControl.setNumIter(0) kills python/kernels

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
• Urgent?:
No

#### Description

Obviously it's a dumb "just don't do that" kind of thing, but if you just

 import lsst.afw.math as afwMath sctrl = afwMath.StatisticsControl() sctrl.setNumIter(0)

then you get a C++ assertion error, but things then propagate in a way that kills python/your kernel.

#### Activity

Hide

https://github.com/lsst/afw/tree/tickets/DM-29069

I'm not sure why but the branch isn't showing up on Jira. There are two possible ways (in two different commits) of fixing it - either by checking the input parameter at the pybind11 layer and throwing an exception, or doing that within the C++ layer. It makes sense to reserve assert in a method to assert the method performed as excepted, rather than asserting that it received inputs as expected. So I'm for dropping the commit that throws the exception from pybind11.

Show
Arun Kannawadi added a comment - https://github.com/lsst/afw/tree/tickets/DM-29069 I'm not sure why but the branch isn't showing up on Jira. There are two possible ways (in two different commits) of fixing it - either by checking the input parameter at the pybind11 layer and throwing an exception, or doing that within the C++ layer. It makes sense to reserve assert in a method to assert the method performed as excepted, rather than asserting that it received inputs as expected. So I'm for dropping the commit that throws the exception from pybind11.
Hide
Show
Hide
Show
Hide
Morgan Schmitz added a comment -

LGTM (once the commits are cleaned up)!

Show
Morgan Schmitz added a comment - LGTM (once the commits are cleaned up)!
Hide

Discarded the changes to _statistics.cc and merged.

Show
Arun Kannawadi added a comment - Discarded the changes to _statistics.cc and merged.

#### People

Assignee:
Reporter:
Merlin Fisher-Levine
Reviewers:
Morgan Schmitz
Watchers:
Arun Kannawadi, Jim Bosch, Merlin Fisher-Levine, Morgan Schmitz