Message154272
| Author |
skrah |
| Recipients |
brett.cannon, eric.snow, nadeem.vawda, ncoghlan, pitrou, skrah |
| Date |
2012年02月25日.16:59:52 |
| SpamBayes Score |
4.8010325e-09 |
| Marked as misclassified |
No |
| Message-id |
<1330189193.32.0.150795755914.issue14080@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
And indeed, with this patch ...
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -777,6 +777,8 @@
mtime = _os.stat(self.path).st_mtime
except OSError:
mtime = -1
+ if fullname == 'pep3147':
+ print(mtime, self._path_mtime)
if mtime != self._path_mtime or _cache_refresh != self._cache_refresh:
self._fill_cache()
self._path_mtime = mtime
Good version:
[stefan@fedora-16-amd64 cpython]$ ./python -m test test_dot
[1/1] test_dot
1330188705.3170006 1330188705.3100004
Warning -- sys.path was modified by test_dot
Bad version:
$ ./python -m test test_dot
[1/1] test_dot
1330188676.0 1330188676.0
Warning -- sys.path was modified by test_dot
test test_dot crashed -- Traceback (most recent call last):
File "/home/stefan/pydev/cpython-imp/Lib/test/regrtest.py", line 1214, in runtest_inner
the_package = __import__(abstest, globals(), locals(), [])
File "/home/stefan/pydev/cpython-imp/Lib/test/test_dot.py", line 20, in <module>
assert m.__file__ == expected___file__
AssertionError
1 test failed:
test_dot
It looks like os.stat.st_mtime returns full seconds here on Ubuntu:
Python 3.3.0a0 (default:3f9b3b6f7ff0, Feb 25 2012, 17:42:23)
[GCC 4.4.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat("./python").st_mtime
1330189060.0
>>>
Nanoseconds, anyone? :) |
|