[BUG] Access denied on Windows when attempting to delete a temporary file created by the install process
setuptools version
setuptools==65.4.1
Python version
Python 3.9.7
OS
Windows 10
Additional environment information
This only happens on Windows, only when installing with pip -e, and I've so far only ever seen it with Cython.
Description
When installing a Cython project with pip -e on Windows, it seems to create a read-only file and then attempt to delete it, always resulting in an access denied error even when run from an administrator shell.
This is effectively a duplicate of the Cython issue https://github.com/cython/cython/issues/4489 (see more detail there). Cython claims that it's a distutils/setuptools error, however, and the most recent time I got this issue the log explicitly directed me to raise an issue here (see log below).
Expected behavior
At least when run as administrator, I shouldn't be seeing access denied errors, especially due to files created by the build process itself.
How to Reproduce
The project I've been experiencing this error with is cPyparsing. It should be reproducible if you clone the repository and pip install -e . on Windows.
Output
log: https://gist.github.com/evhub/fbf4657752e4595b83b582e626fa0fb9