Message140997
| Author |
neologix |
| Recipients |
eric.araujo, joshtriplett, ncoghlan, neologix, ron_adam, vstinner |
| Date |
2011年07月23日.17:21:36 |
| SpamBayes Score |
2.791949e-06 |
| Marked as misclassified |
No |
| Message-id |
<1311441697.21.0.800776453563.issue12603@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Demo:
"""
cf@neobox:~/cpython$ ./python -c "import pydoc; print(pydoc.synopsis('Lib/os.py'))"
OS routines for Mac, NT, or Posix depending on what system we're on.
[51835 refs]
cf@neobox:~/cpython$ touch -t 197001010000 Lib/os.py
cf@neobox:~/cpython$ ./python -c "import pydoc; print(pydoc.synopsis('Lib/os.py'))"
None
[51833 refs]
"""
> I'd suggest using the fix of changing the .get call to return a default of (None,
> None) and changing the conditional to "lastupdate is not None and
> lastupdate < mtime".
You mean "lastupdate is None or lastupdate < mtime"? Otherwise, a file not present in the cache would never be looked-up.
Here's a patch.
It's obvious, but note that if the filesystem doesn't provide mtime, then once the metadata has been cached, it won't be refreshed if the file is updated.
I'll take a look around the standard library for similar issues.
Note: it would of course be simpler to use -1 as the default mtime value, but a negative time_t is possible. |
|