• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scikit-hep / iminuit / 30187204209
100%

Build:
DEFAULT BRANCH: develop
Ran 26 Jul 2026 04:07AM UTC
Jobs 1
Files 18
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

26 Jul 2026 04:04AM UTC coverage: 99.617%. Remained the same
30187204209

push

github

web-flow
fix: bounds, lifetime, and equality bugs in C++ bindings (#1134)

:robot: _AI text below_ :robot:

Addresses part of #1132.

This fixes a set of reviewed, pre-verified bugs in the pybind11 bindings
(several reproduced as interpreter crashes), plus a few small
simplifications. Adds Python-level regression tests in
`tests/test_core.py`.

## Crash / correctness fixes

1. **Out-of-range negative index → SIGBUS**
(`src/userparameterstate.cpp`): `getitem` adjusted a negative index but
never re-checked `i < 0`, so `state[-(n+1)]` fed a negative int into
`Parameter(unsigned)` and crashed the interpreter. Now re-checks `if (i
< 0 || i >= n) throw py::index_error();`, matching
`usertransformation.cpp`. `MnUserCovariance.__getitem__`
(`src/usercovariance.cpp`) had **no** bounds check at all — added range
checks for both indices with negative-index support.
2. **`nan_equal` tautology** (`src/equal.cpp`): `std::isnan(a) ==
std::isnan(b) || a == b` is true for *any* two non-NaN values, so
`MinuitParameter::operator==` never actually compared limit values
(states with limits `(-1, 5)` vs `(-2, 7)` compared equal). Now `a == b
|| (std::isnan(a) && std::isnan(b))`.
3. **Missing `keep_alive` → segfault** (`src/minos.cpp`,
`src/contours.cpp`, `src/scan.cpp`): `MnMinos`/`MnContours` store `const
FCNBase&` and `const FunctionMinimum&` references, `MnScan` stores
`const FCNBase&`. Added `py::keep_alive<1, 2>()` (FCN) to all three and
`py::keep_alive<1, 3>()` (FunctionMinimum) to `MnMinos`/`MnContours`,
matching `migrad.cpp`/`simplex.cpp`.
4. **`__iter__` missing `keep_alive<0, 1>`**
(`src/userparameterstate.cpp`, `src/usertransformation.cpp`):
`py::make_iterator` over the internal vector without keeping the parent
alive. Added `keep_alive<0, 1>()` to both.
5. **`MnPrint` dangling prefix** (`src/print.cpp`): `py::init<cstr,
int>()` stored a `const char*` owned by a dead temporary (the prefix is
pushed onto a long-lived stack), producing garbage /
`UnicodeDecodeError`. Repla... (continued)

3898 of 3913 relevant lines covered (99.62%)

1.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 30187204209.1 26 Jul 2026 04:07AM UTC 18
99.62
Source Files on build 30187204209
  • Tree
  • List 18
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 76a866f4 on github
  • Prev Build on develop (#30125996193)
  • Next Build on develop (#30248843585)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc