Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(90968)

#19077: More robust TemporaryDirectory cleanup

Can't Edit
Can't Publish+Mail
Start Review
Created:
5 years, 11 months ago by storchaka+cpython
Modified:
5 years, 7 months ago
Reviewers:
pitrou
CC:
Georg, Nick Coghlan, AntoinePitrou, haypo, devnull_psf.upfronthosting.co.za, sbt, storchaka
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Patch Set 4 #

Total comments: 8

Patch Set 5 #

Patch Set 6 #

Patch Set 7 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/tempfile.py View 1 2 3 4 5 6 5 chunks +29 lines, -61 lines 0 comments Download
Lib/test/test_tempfile.py View 1 2 3 4 5 6 4 chunks +39 lines, -47 lines 0 comments Download
Misc/NEWS View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 3
storchaka_gmail.com
http://bugs.python.org/review/19077/diff/10507/Lib/test/test_tempfile.py File Lib/test/test_tempfile.py (right): http://bugs.python.org/review/19077/diff/10507/Lib/test/test_tempfile.py#newcode1166 Lib/test/test_tempfile.py:1166: tmp2 = os.path.join(tmp.name, 'test_dir') It will be better to ...
5 years, 7 months ago #1
AntoinePitrou
Thanks for the comments. Can you pick up and finalize the patch? http://bugs.python.org/review/19077/diff/10507/Lib/test/test_tempfile.py File Lib/test/test_tempfile.py ...
5 years, 7 months ago #2
storchaka_gmail.com
5 years, 7 months ago #3
http://bugs.python.org/review/19077/diff/10507/Lib/test/test_tempfile.py
File Lib/test/test_tempfile.py (right):

http://bugs.python.org/review/19077/diff/10507/Lib/test/test_tempfile.py#newc...
Lib/test/test_tempfile.py:1166: tmp2 = os.path.join(tmp.name, 'test_dir')
On 2014/01/10 00:28:18, AntoinePitrou wrote:
> On 2014/01/10 00:25:25, storchaka wrote:
> > It will be better to test more directory levels. Some bugs are exposed only
> with
> > deeper nested subdirectories.
> 
> Which bugs? We are only testing shutil.rmtree here.

I already don't remember. Perhaps this is not needed.

http://bugs.python.org/review/19077/diff/10507/Lib/test/test_tempfile.py#newc...
Lib/test/test_tempfile.py:1172: """.format(dir=dir)
On 2014/01/10 00:28:18, AntoinePitrou wrote:
> On 2014/01/10 00:25:25, storchaka wrote:
> > What if tmp is long lived? E.g. assigned as an attribute in the builtins
> module?
> > Or linked in reference loop?
> 
> Then weakref.finalize() would probably not clean it up (it uses atexit,
AFAIR).

I just checked.

                import builtins
                builtins.tmp = tmp
                os.tmp = tmp
                refloop = [tmp]
                refloop.append(refloop)
                tmp.selfref = tmp

Test is passed. With my patch test is passed if remove assigning as builtins
attribute.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+