Closed xobs closed 2 years ago
This error is called out on the Python docs page at https://docs.python.org/3.9/library/tempfile.html#tempfile.NamedTemporaryFile:
Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows).
Running
idf.py clang-check
errors with a traceback:This is due to a bug in
pyclang
.It attempts to open a file using
with tempfile.NamedTemporaryFile() as fw:
, which opens the file. However, it then attempts to open the file a second time, which is an undefined operation.This results in a permissions error on Windows, since tempfiles are exclusive access.
The following patch to
Lib/site-packages/pyclang/utils.py
fixes the problem: