Skip to content

fix: close progress bars when save/download fails#434

Open
voidborne-d wants to merge 3 commits intogoogle:mainfrom
voidborne-d:fix-progress-bars-close-on-exception
Open

fix: close progress bars when save/download fails#434
voidborne-d wants to merge 3 commits intogoogle:mainfrom
voidborne-d:fix-progress-bars-close-on-exception

Conversation

@voidborne-d
Copy link
Copy Markdown

@voidborne-d voidborne-d commented Apr 5, 2026

Description

Fixes the progress-bar cleanup bug in langextract/io.py by closing both the save and download tqdm bars from finally blocks, so generator failures and streaming request errors do not leave terminal state behind.

Fixes #401

Bug fix

How Has This Been Tested?

pytest -q tests/io_test.py

Checklist:

  • I have read and acknowledged Google's Open Source Code of conduct.
  • I have read the Contributing page, and I either signed the Google Individual CLA or am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have made any needed documentation changes, or noted in the linked issue(s) that documentation elsewhere needs updating.
  • I have added tests, or I have ensured existing tests cover the changes.
  • I have followed Google's Python Style Guide and ran pylint over the affected code.

@github-actions github-actions bot added the size/S Pull request with 50-150 lines changed label Apr 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

No linked issues found. Please link an issue in your pull request description or title.

Per our Contributing Guidelines, all PRs must:

  • Reference an issue with one of:
    • Closing keywords: Fixes #123, Closes #123, Resolves #123 (auto-closes on merge in the same repository)
    • Reference keywords: Related to #123, Refs #123, Part of #123, See #123 (links without closing)
  • The linked issue should have 5+ 👍 reactions from unique users (excluding bots and the PR author)
  • Include discussion demonstrating the importance of the change

You can also use cross-repo references like owner/repo#123 or full URLs.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

⚠️ Branch Update Required

Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

@voidborne-d
Copy link
Copy Markdown
Author

Quick note: this PR already links the issue in the description via Fixes #401.

I also refreshed the branch earlier today, and GitHub's update-branch API now reports there are no newer commits on main, so the remaining blockers here look bot-side rather than code-side.

@github-actions
Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 2 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Pull request with 50-150 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: progress_bar resource leak — not closed on exception in save_annotated_documents and download_text_from_url

1 participant