"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "abbc96a2148da0c91fa078bd021984b2cc10ef85"
Unverified Commit 80ca9247 authored by ready-research's avatar ready-research Committed by GitHub
Browse files

Use `mkstemp` to replace deprecated `mktemp` (#23372)

* Use `mkstemp` to replace deprecated `mktemp`

The `tempfile.mktemp` function is [deprecated](https://docs.python.org/3/library/tempfile.html#tempfile.mktemp) due to [security issues](https://cwe.mitre.org/data/definitions/377.html

).

* Update src/transformers/utils/hub.py
Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>

---------
Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>
parent ba6815e8
...@@ -578,7 +578,7 @@ def download_url(url, proxies=None): ...@@ -578,7 +578,7 @@ def download_url(url, proxies=None):
" that this is not compatible with the caching system (your file will be downloaded at each execution) or" " that this is not compatible with the caching system (your file will be downloaded at each execution) or"
" multiple processes (each process will download the file in a different temporary file)." " multiple processes (each process will download the file in a different temporary file)."
) )
tmp_file = tempfile.mktemp() tmp_file = tempfile.mkstemp()[1]
with open(tmp_file, "wb") as f: with open(tmp_file, "wb") as f:
http_get(url, f, proxies=proxies) http_get(url, f, proxies=proxies)
return tmp_file return tmp_file
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment