Repository navigation
fix: return an empty iterator for empty worksheets - #238
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughEmpty sheet ranges now initialize without a missing-start panic and stop iteration immediately. Tests cover empty sheets in XLSX, XLS, XLSB, and ODS workbooks. ChangesEmpty Sheet Iteration
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Empty worksheets now yield no rows and remain exhausted on subsequent calls. The reviewed change presents no actionable merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks a sheet so wide, Comment |
|
Thanks! |
Summary
Calling
iter_rows()on an empty worksheet raisesPanicExceptionbecause its range has no start coordinate. Default the private coordinate and return exhaustion before updating the counter for an empty range, so repeatednext()calls also stay exhausted.The regression reuses the existing XLSX, XLS, XLSB and ODS fixtures and covers empty iteration, repeated
StopIterationand an identity sentinel default.Verification
pip install -e .succeeds,pytestpasses 55 tests with that same expected failure, and all 14pre-commit run --all-fileshooks pass.(1, 1). Their iterators also work after external workbook/sheet references are gone.u32::MAX; removing only the empty guard produces an arithmetic overflow. The probe restores the source and is outside this PR.Risks and unverified checks
This changes empty-range iterator construction and exhaustion. Final Windows/macOS native builds, other Python versions, PyPy, free-threaded Python, PyEmscripten, release wheels, coverage and successful upstream CI remain unverified. The existing unsafe lifetime arrangement has not received a general audit.