Skip to content

Conversation

@swastim01
Copy link

@swastim01 swastim01 commented Oct 26, 2025

Set zip(..., strict=True) in key solver/expression tree files for length safety

Description

This PR updates the solver and expression tree files to use zip(..., strict=True) where appropriate. This ensures that all zip operations fail fast if input iterables have mismatched lengths, improving code safety and preventing subtle bugs.

Fixes #5060

Type of change

  • Bug fix (non-breaking change which improves code safety)

Changelog

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #):

## Bug Fixes

- Set `zip(..., strict=True)` in solver and expression tree files to ensure iterable length safety. ([#5241](https://github.com/pybamm-team/PyBaMM/pull/5241))

Important checks

Please confirm the following before marking the PR as ready for review:

  • No style issues: nox -s pre-commit
  • All tests pass: nox -s tests
  • Documentation builds: nox -s doctests
  • Code is commented for hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@swastim01 swastim01 requested a review from a team as a code owner October 26, 2025 11:47
@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.82%. Comparing base (d536255) to head (78f3ec4).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5241   +/-   ##
========================================
  Coverage    98.82%   98.82%           
========================================
  Files          321      321           
  Lines        27491    27491           
========================================
  Hits         27169    27169           
  Misses         322      322           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@MarcBerliner MarcBerliner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @swastim01, just one thing to clean up the changelog. Otherwise, looks good to me!

Copy link
Member

@MarcBerliner MarcBerliner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MarcBerliner MarcBerliner enabled auto-merge (squash) October 27, 2025 18:37
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.

Set strict=True in the zip() calls

2 participants