Skip to content

Release XLS and XLSX workbook resources when decoding fails - #648

Open
ShahadatTest wants to merge 1 commit into
fabiocaccamo:mainfrom
ShahadatTest:fix/release-workbooks-on-decode-errors
Open

ShahadatTest wants to merge 1 commit into
fabiocaccamo:mainfrom
ShahadatTest:fix/release-workbooks-on-decode-errors

Conversation

@ShahadatTest

Copy link
Copy Markdown

Describe your changes

Selecting a missing worksheet or failing while reading a row exits XLSX decoding before workbook.close() and VBA-archive cleanup. Legacy XLS decoding also never explicitly releases the workbook resources. Repeated failed imports can retain file/archive resources.

Move existing XLSX cleanup into finally, and release legacy workbook resources in finally after both successful and failed decoding. Original decoding errors still propagate. Tests cover invalid sheet names/indexes, row-reading errors and successful legacy decoding.

Related issue

Independently reproduced; no matching open issue or PR found.

Validation

Five new cleanup assertions fail on the original implementation. Full Python 3.12 unittest suite: 994 passed. Focused XLS tests: 20 passed. Ruff lint/format, mypy on the changed module, and git diff --check pass.

AI assistance

Prepared and tested with OpenAI Codex (GPT-6). Original user request: new 14ta koro aro (make 14 more new contributions). Diff inspection was automated; no human review or personal production usage is claimed.

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.

1 participant