This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: support.temp_cwd should use support.rmtree
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, pitrou, python-dev, r.david.murray, sean.rodman
Priority: normal Keywords: buildbot, easy, patch

Created on 2013-11-15 17:44 by r.david.murray, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue19614.patch sean.rodman, 2014-02-24 23:54 patch to address shutil.rmtree being used in temp_dir review
Messages (6)
msg202962 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-11-15 17:44
Based on this error on one of the buildbots, it is clear that support.temp_cwd should be calling support.rmtree, and not shutil.rmtree, during cleanup:

[...]
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\regrtest.py", line 1585, in <module>
    main_in_temp_cwd()
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\regrtest.py", line 1560, in main_in_temp_cwd
    main()
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\support\__init__.py", line 868, in temp_cwd
    yield cwd_dir
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\support\__init__.py", line 822, in temp_dir
    shutil.rmtree(path)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py", line 477, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py", line 376, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py", line 374, in _rmtree_unsafe
    os.rmdir(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4744'
[...]
msg212149 - (view) Author: Sean Rodman (sean.rodman) * Date: 2014-02-24 23:43
Hey r.david.murray, so should this change be made in the test?
msg212150 - (view) Author: Sean Rodman (sean.rodman) * Date: 2014-02-24 23:54
I don't see where temp_cwd uses shutil.rmtree, but I do see where temp_dir uses shutil.rmtree. Here is a patch to change that to support.rmtree. If I am way off base on this patch please let me know and I will change it to fix whatever needs to be fixed. I want to contribute to python as much as I can so I will do anything to get this fixed that is necessary. Please let me know what you think.
msg212653 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-03-03 18:52
Thanks.  Yes, the fix is in temp_dir.  Patch looks fine, may be a bit before I get around to applying it.
msg213282 - (view) Author: Sean Rodman (sean.rodman) * Date: 2014-03-12 19:51
Thank you for reviewing it.
msg213286 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-12 20:07
New changeset a5f767bf9d1c by Benjamin Peterson in branch '3.3':
use support.rmtree instead of shutil (closes #19614)
http://hg.python.org/cpython/rev/a5f767bf9d1c

New changeset 8a77e22aff6c by Benjamin Peterson in branch 'default':
merge 3.3 (#19614)
http://hg.python.org/cpython/rev/8a77e22aff6c
History
Date User Action Args
2022-04-11 14:57:53adminsetgithub: 63813
2014-03-12 20:07:36python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg213286

resolution: fixed
stage: needs patch -> resolved
2014-03-12 19:51:34sean.rodmansetmessages: + msg213282
2014-03-03 18:52:48r.david.murraysetmessages: + msg212653
2014-02-24 23:54:07sean.rodmansetfiles: + issue19614.patch
keywords: + patch
messages: + msg212150
2014-02-24 23:43:52sean.rodmansetnosy: + sean.rodman
messages: + msg212149
2013-11-25 03:10:21ezio.melottisetnosy: + pitrou, ezio.melotti
2013-11-15 17:44:46r.david.murraycreate