Message140826
| Author |
joshtriplett |
| Recipients |
joshtriplett |
| Date |
2011年07月21日.20:33:10 |
| SpamBayes Score |
1.2521708e-07 |
| Marked as misclassified |
No |
| Message-id |
<1311280391.94.0.571188388286.issue12603@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In Python 2.7.2, pydoc.py's synopsis contains this code implementing a cache:
mtime = os.stat(filename).st_mtime
lastupdate, result = cache.get(filename, (0, None))
if lastupdate < mtime:
Many filesystems don't have any concept of mtime or don't have it available, including many FUSE filesystems, as well as our implementation of stat for GRUB in BITS. Such systems typically return an mtime of 0. (In addition, 0 represents a valid mtime.) Since the cache in pydoc.synopsis initializes lastupdate to 0 for entries not found in the cache, this causes synopsis to always return None. I'd suggest either extending the conditional to check "lastupdate != 0 and lastupdate < mtime" (which would always treat an mtime of 0 as requiring an update, which would make sense for filesystems without valid mtimes) or changing the .get to return (None, None) and checking "lastupdate is not None and lastupdate < mtime", which would treat an mtime of 0 as valid but still handle the case of not having a cache entry the first time. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年07月21日 20:33:12 | joshtriplett | set | recipients:
+ joshtriplett |
| 2011年07月21日 20:33:11 | joshtriplett | set | messageid: <1311280391.94.0.571188388286.issue12603@psf.upfronthosting.co.za> |
| 2011年07月21日 20:33:11 | joshtriplett | link | issue12603 messages |
| 2011年07月21日 20:33:10 | joshtriplett | create |
|