Files
Carson Jones 27589a1539 Add mutex lock to prevent concurrent download() corruption
Concurrent calls to yf.download() from separate threads share the
module-level _DFS, _ERRORS, and _TRACEBACKS dicts, causing one call
to overwrite or read another's results. Serialize access with a
threading.Lock so each download() runs atomically.

Fixes #2557
2026-03-12 17:05:08 -04:00

30 lines
826 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# yfinance - market data downloader
# https://github.com/ranaroussi/yfinance
#
# Copyright 2017-2019 Ran Aroussi
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import threading
_DFS = {}
_PROGRESS_BAR = None
_ERRORS = {}
_TRACEBACKS = {}
_ISINS = {}
_LOCK = threading.Lock()