Opened 14 years ago

Closed 14 years ago

#2896 defect closed fixed (fixed)

FilePath.exists gives results inconsistent with FilePath.isdir

Reported by: Jean-Paul Calderone Owned by:
Priority: highest Milestone:
Component: core Keywords:
Cc: Branch: branches/filepath-exists-2896
branch-diff, diff-cov, branch-cov, buildbot
Author: therve


Consider this:

>>> from twisted.python.filepath import FilePath
>>> fp = FilePath('foobarbaz')
>>> fp.exists() # important, causes FilePath to cache a does-not-exist state
>>> fp.makedirs()
>>> fp.exists()
>>> fp.isdir()

Change History (7)

comment:1 Changed 14 years ago by therve

Owner: changed from Glyph to therve

comment:2 Changed 14 years ago by therve

author: therve
Branch: branches/filepath-exists-2896

(In [22487]) Branching to 'filepath-exists-2896'

comment:3 Changed 14 years ago by therve

(In [22488]) Force restat in exists, add a test.

Refs #2896

comment:4 Changed 14 years ago by therve

Keywords: review added
Owner: therve deleted
Priority: highhighest

comment:5 Changed 14 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to therve

exists docstring reads a bit awkwardly, ... can be stated correctly ..., since "stated" is a different english word.

Typo in test_crossMountMoveTo docstring - os.renamed

The fix looks good, so far as it goes. I wonder if FilePath wouldn't be better off just discarding the stat information after each mutating operation (and letting the next thing that cares do the restat - if it ever happens at all). That's beyond the scope of this ticket though, I guess.

Feel free to merge once the docstrings are fixed.

comment:6 Changed 14 years ago by therve

Resolution: fixed
Status: newclosed

(In [22593]) Merge filepath-exists-2896

Author: therve Reviewer: exarkun Fixes #2896

Force twisted.python.filepath.FilePath.exists to call restat: this prevents it from using wrong cached value.

comment:7 Changed 11 years ago by <automation>

Owner: therve deleted
Note: See TracTickets for help on using tickets.