Skip to content

Match empty iterable sources without testing their truth value - #382

Merged
dgilland merged 2 commits into
dgilland:developfrom
ShahadatTest:fix/empty-iterable-matches
Oct 29, 2026
Merged

dgilland merged 2 commits into
dgilland:developfrom
ShahadatTest:fix/empty-iterable-matches

Conversation

@ShahadatTest

Copy link
Copy Markdown
Contributor

is_match([], iter([])) returns False, while the equivalent empty-list source returns True. is_match_with truth-tests the source before iterating it; unsized empty iterators are truthy, and iterable containers with no scalar truth value raise instead. Initialize the empty-conjunction result to True and let actual comparisons determine nonempty matches.

Five new regressions fail before the fix, with nonempty mismatch controls. Full unit tests and doctests: 2,987 passed on Python 3.12 and 3.10; 100% coverage on 3.12. Ruff formatting/lint, mypy over package plus changed tests, and diff checks pass. The separate mypy-testing collection, other Python versions, packaging and documentation builds were not run.

Found during source inspection. Prepared with OpenAI Codex (GPT-6) assistance for new 20ta koro (make 20 new contributions). Investigation, implementation and tests were AI-assisted; no personal production use or human code review is claimed.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — ShahadatTest:fix/empty-iterable-matches into dgilland:develop

@dgilland
dgilland merged commit 8983c3c into dgilland:develop Oct 29, 2026
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.

3 participants