Skip to content

Remove dead network.hide_exceptions toggle from download() - #3025

Open
louis75aubin-prog wants to merge 1 commit into
ranaroussi:devfrom
louis75aubin-prog:fix/download-dead-hide-exceptions
Open

louis75aubin-prog wants to merge 1 commit into
ranaroussi:devfrom
louis75aubin-prog:fix/download-dead-hide-exceptions

Conversation

@louis75aubin-prog

Copy link
Copy Markdown
Contributor

Follow-up to #3019, where I raised this as a question.

Problem

multi._download_one saves YfConfig.network.hide_exceptions, sets it to False, then restores it. Nothing in yfinance reads network.hide_exceptions: every reader uses YfConfig.debug.hide_exceptions. The toggle came in with 4f38ecf ("Redesign YfConfig"), which replaced history(..., raise_errors=True) with it.

So it has no effect on download(). Its only visible effect is a stray key left in the global config after any download:

>>> yf.download(['AAPL'], progress=False)
>>> yf.config.network
{
    "proxy": null,
    "retries": 0,
    "hide_exceptions": null
}

Change

Remove the three lines and the now-unused YfConfig import from multi.py. download() behaviour is unchanged: errors are still collected through _last_error / the except block and logged by _log_errors() exactly as before.

I didn't switch it to debug.hide_exceptions, which was probably the original intent. That would change download()'s behaviour: history() would raise again, and the "Failed downloads" messages would change. It would also mean flipping a process-wide flag from worker threads, which other threads and other concurrent yfinance calls would see.

Tests

  • New tests/test_multi.py::test_download_leaves_config_unchanged (no network): repr(yf.config) is the same before and after a threaded download(). It fails on dev and passes with this change.
  • python -m unittest tests.test_multi tests.test_download_concurrency: 13 tests OK.
  • ruff check yfinance/ tests/test_multi.py: clean.

@ValueRaider

Copy link
Copy Markdown
Collaborator

This stinks of bad AI.

_download_one saved, set and restored YfConfig.network.hide_exceptions,
but nothing reads that option: every reader uses debug.hide_exceptions.
It came from the YfConfig redesign replacing history(raise_errors=True).

Its only effect was a stray "hide_exceptions": null left in
yf.config.network after every download(). Removing it changes no
download behaviour.
@louis75aubin-prog
louis75aubin-prog force-pushed the fix/download-dead-hide-exceptions branch from f6bb0ac to 1357687 Compare November 3, 2026 16:49

This branch has not been deployed

No deployments
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.

2 participants