Message12048

Author jeff.allen
Recipients jeff.allen
Date 2018-07-11.13:32:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1531315925.53.0.56676864532.issue2697@psf.upfronthosting.co.za>
In-reply-to
Content
When we JAR together a Python module and its source, as we do for jython-standalone, and want to for the Gradle build, Jython always chooses to re-compile the source, rather than use the pre-compiled class.

This is apparently because in org.python.imp.readCodeData, we check that the time embedded in the $py.class file is the same as the last-modified time on the source file. The former is taken from the filesystem (via java.io.File.lastModified) during compilation, and pretends millisecond resolution. The latter is taken from the ZIP file directory and has been rounded to 2 seconds, DOS-style.

I think the answer is to make the comparison more forgiving where the importer is a zipimporter (by overriding a comparison function, say).

I noticed this when testing the JAR produced by Gradle. In #1090, I was unable to reproduce the OP's problem, but it may be that having the source in there was the key. Not sure of this, and it's been 10 years, so I'm raising new issue.
History
Date User Action Args
2018-07-11 13:32:05jeff.allensetrecipients: + jeff.allen
2018-07-11 13:32:05jeff.allensetmessageid: <1531315925.53.0.56676864532.issue2697@psf.upfronthosting.co.za>
2018-07-11 13:32:05jeff.allenlinkissue2697 messages
2018-07-11 13:32:04jeff.allencreate