summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pkg.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-03-22 23:27:02 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-03-22 23:27:02 (GMT)
commit3b654be1a48f6d8584c169e08687c02de0a4a71c (patch)
tree37436b87de530778d28ee9bb44cc9572318c199b /Lib/test/test_pkg.py
parenta8e4d6eb6e386dc12fa586bd4a920546b505f17b (diff)
downloadcpython-3b654be1a48f6d8584c169e08687c02de0a4a71c.zip
cpython-3b654be1a48f6d8584c169e08687c02de0a4a71c.tar.gz
cpython-3b654be1a48f6d8584c169e08687c02de0a4a71c.tar.bz2
Issue #10771: Clarify that descriptors get used in an *owner* class or one of its parents.
Diffstat (limited to 'Lib/test/test_pkg.py')
0 files changed, 0 insertions, 0 deletions
pan class="hl opt">: verbose = silent = False MAGIC = importlib.util.MAGIC_NUMBER if not silent: print('Using MAGIC word', repr(MAGIC)) for dirname in sys.path: try: names = os.listdir(dirname) except OSError: print('Cannot list directory', repr(dirname)) continue if not silent: print('Checking ', repr(dirname), '...') for name in sorted(names): if name.endswith('.py'): name = os.path.join(dirname, name) try: st = os.stat(name) except OSError: print('Cannot stat', repr(name)) continue if verbose: print('Check', repr(name), '...') name_c = cache_from_source(name) try: with open(name_c, 'rb') as f: magic_str = f.read(4) mtime_str = f.read(4) except IOError: print('Cannot open', repr(name_c)) continue if magic_str != MAGIC: print('Bad MAGIC word in ".pyc" file', end=' ') print(repr(name_c)) continue mtime = get_long(mtime_str) if mtime in {0, -1}: print('Bad ".pyc" file', repr(name_c)) elif mtime != st[ST_MTIME]: print('Out-of-date ".pyc" file', end=' ') print(repr(name_c)) def get_long(s): if len(s) != 4: return -1 return s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24) if __name__ == '__main__': main()