Jython

Issue1024

classification
Title: Jython $py.class bytecode doesn't include the .py's mtime
Type: behaviour Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: cgroves, fwierzbicki, pjenvey, zyasoft
Priority: normal Keywords: test failure causes

Created on 2008年04月17日.06:04:28 by pjenvey, last changed 2009年03月06日.04:16:19 by fwierzbicki.

Messages
msg3157 (view) Author: Philip Jenvey (pjenvey) Date: 2008年04月17日.06:04:27
CPython .pyc files include the modified time of the .py file it was 
created from. CPython then knows that the .pyc is up to date by 
comparing the .py's mtime against the .pyc's stored value
Jython doesn't store this value in $py.class, all it does is compare the 
$py.class's mtime against .py on the filesystem
This doesn't seem like a big deal but it makes us incompatible with 
CPython
I ran into a situation where this caused a hard to diagnose problem: a 
test would generate a sample.py file and invoke a separate process to 
import it. Then it would copy a different version of the same sample.py 
file over, and invoke another process that imported it.
The first $py.class generated actually ended up having the same mtime as 
the second .py that was copied over. Because we only compare the mtimes 
of the files themselves, Jython assumed the bytecode was up to date when 
it wasn't, the second .py wasn't compiled/used (causing a very weird 
bug)
In this situation in CPython, the first .pyc might have the same mtime 
as the second .py, like our situation above in Jython, but CPython would 
actually be comparing the second .py's mtime against the mtime of the 
first .py, which in this situation were reliably different.
We need to work this way too to avoid surprises like this with code 
written for CPython
msg3158 (view) Author: Charlie Groves (cgroves) Date: 2008年04月17日.20:33:37
Issue #1567212 reports the same underlying issue, though it could use a
better title
msg3159 (view) Author: Philip Jenvey (pjenvey) Date: 2008年04月17日.20:45:26
dupe of #1567212 
msg3549 (view) Author: Jim Baker (zyasoft) Date: 2008年09月13日.23:10:45
Assigned to myself to fix in org.python.compiler.ClassFile#write and
corresponding org.python.core.imp#readCode
msg4177 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009年03月06日.04:16:18
fixed in r6071 
History
Date User Action Args
2009年03月06日 04:16:19fwierzbickisetstatus: open -> closed
resolution: duplicate -> fixed
messages: + msg4177
2009年03月03日 20:37:18fwierzbickisetassignee: zyasoft -> fwierzbicki
nosy: + fwierzbicki
2008年09月13日 23:10:45zyasoftsetstatus: closed -> open
assignee: zyasoft
messages: + msg3549
nosy: + zyasoft
2008年04月17日 20:45:27pjenveysetstatus: open -> closed
resolution: duplicate
messages: + msg3159
priority: normal
2008年04月17日 20:33:37cgrovessetnosy: + cgroves
messages: + msg3158
2008年04月17日 06:04:28pjenveycreate

Supported by Python Software Foundation,
Powered by Roundup

AltStyle によって変換されたページ (->オリジナル) /