when pycs are compiled, the python version magic number + mtime of the file are written to the pyc header. before re-compiling, python checks the mtime of the target file and compares that to what’s written in the header (as well as the magic number). if they don’t match, it’s recompiled/overwritten. I think this should be a pretty safe strategy unless for some reason mtimes on the files dont get properly set.