Summary
EqSolver, RocketSolver, ShockSolver, and DetonationSolver's num_reactants/num_products/num_gas/num_condensed/num_elements/max_equations properties all call cea_*_get_size(...), assign the result to ierr, and return the output value without ever checking ierr. The same pattern applies to _version_major/_version_minor/_version_patch and set_log_level. Every other C-call site in CEA.pyx routes its ierr through _check_ierr(...); these are the only ones that don't.
Reproduction
- Interface: Python
- Minimal input / steps: Not reproducible as a live failure without an artificial C-side failure injection — this is a static-analysis finding from reading
source/bind/python/CEA.pyx.
- Command or API call used: e.g.
EqSolver.num_reactants, RocketSolver.num_gas, cea._version_major()
Expected behavior
If cea_eqsolver_get_size (or the rocket/shock/detonation equivalents, or cea_version_major) returns a non-SUCCESS error code, the Python property/function should raise RuntimeError via _check_ierr, matching the error-handling convention used by every other binding call in the file.
Actual behavior
The error code is silently discarded and the (potentially uninitialized/stale) size_val/major/minor/patch is returned as if the call had succeeded. Confirmed by direct inspection — every other ierr = cea_...(...) assignment in CEA.pyx is immediately followed by a _check_ierr(ierr, ...) call except these:
EqSolver: CEA.pyx:1406,1420,1434,1448,1462,1476 (num_reactants, num_products, num_gas, num_condensed, num_elements, max_equations)
RocketSolver: CEA.pyx:2390,2404,2418,2432,2446 (same five size properties)
ShockSolver: CEA.pyx:3336,3350,3364,3378,3392
DetonationSolver: CEA.pyx:4243,4257,4271,4285,4299
_version_major/_version_minor/_version_patch: CEA.pyx:289,303,317
set_log_level: CEA.pyx:330
Environment
- OS: Windows 11
- CEA version/commit: 3.3.4 /
7ec0859
- Compiler or Python version (if relevant): N/A (static finding, applies to any build)
Additional context
These calls are unlikely to fail in normal use (querying the size of an already-constructed solver, or querying the compiled-in version number, is close to infallible), which is likely why this was never caught by a test — but the inconsistency with the rest of the file's error-handling discipline is real, and a future refactor that does make these calls fallible (or a corrupted/partially-initialized solver object) would fail silently instead of raising.
Drafted with Claude's assistance
- Confirmed via a targeted grep across
source/bind/python/CEA.pyx for every ierr = cea_...(...) assignment, then checking whether a _check_ierr call follows — the getters/functions listed above are the only ones where it doesn't.
- Checked
gh issue list on djkees/cea before filing to confirm this isn't a duplicate (searched ierr, get_size).
Summary
EqSolver,RocketSolver,ShockSolver, andDetonationSolver'snum_reactants/num_products/num_gas/num_condensed/num_elements/max_equationsproperties all callcea_*_get_size(...), assign the result toierr, and return the output value without ever checkingierr. The same pattern applies to_version_major/_version_minor/_version_patchandset_log_level. Every other C-call site inCEA.pyxroutes itsierrthrough_check_ierr(...); these are the only ones that don't.Reproduction
source/bind/python/CEA.pyx.EqSolver.num_reactants,RocketSolver.num_gas,cea._version_major()Expected behavior
If
cea_eqsolver_get_size(or the rocket/shock/detonation equivalents, orcea_version_major) returns a non-SUCCESSerror code, the Python property/function should raiseRuntimeErrorvia_check_ierr, matching the error-handling convention used by every other binding call in the file.Actual behavior
The error code is silently discarded and the (potentially uninitialized/stale)
size_val/major/minor/patchis returned as if the call had succeeded. Confirmed by direct inspection — every otherierr = cea_...(...)assignment inCEA.pyxis immediately followed by a_check_ierr(ierr, ...)call except these:EqSolver:CEA.pyx:1406,1420,1434,1448,1462,1476(num_reactants,num_products,num_gas,num_condensed,num_elements,max_equations)RocketSolver:CEA.pyx:2390,2404,2418,2432,2446(same five size properties)ShockSolver:CEA.pyx:3336,3350,3364,3378,3392DetonationSolver:CEA.pyx:4243,4257,4271,4285,4299_version_major/_version_minor/_version_patch:CEA.pyx:289,303,317set_log_level:CEA.pyx:330Environment
7ec0859Additional context
These calls are unlikely to fail in normal use (querying the size of an already-constructed solver, or querying the compiled-in version number, is close to infallible), which is likely why this was never caught by a test — but the inconsistency with the rest of the file's error-handling discipline is real, and a future refactor that does make these calls fallible (or a corrupted/partially-initialized solver object) would fail silently instead of raising.
Drafted with Claude's assistance
source/bind/python/CEA.pyxfor everyierr = cea_...(...)assignment, then checking whether a_check_ierrcall follows — the getters/functions listed above are the only ones where it doesn't.gh issue liston djkees/cea before filing to confirm this isn't a duplicate (searchedierr,get_size).