`f.get_filesize()` is not available in 2.4.  Could test on `f.mode` here if the intent is to set the attribute on a newly opened file.