|
From: Samuele P. <pe...@in...> - 2000-12-22 02:00:27
|
Hi.
Finn, thanks for the help and the many examples. Here is a new patch
proposal.
The difference is minimal but significative:
if (ret != null) {
// Allow a package component to change its own meaning
- PyObject tmp = __dict__.__finditem__(attr);
- if (tmp != null)
- ret = tmp;
+ PyObject tmp = modules.__finditem__(fullName);
+ if (tmp != null) ret = tmp;
__dict__.__setitem__(attr, ret);
return ret;
}
Simply the old jpython code was doing the wrong thing.
I think this version should be ok for check in. Let me know.
Here are the transcripts for the various test-cases with the patch in place:
Jython 2.0alpha2 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> from pack1.Node import Node
>>> print Node,type(Node)
pack1.Node.Node org.python.core.PyClass
>>>
Jython 2.0alpha2 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import pack1
>>> print pack1.Node,type(pack1.Node)
pack1.Node org.python.core.PyClass
>>> from pack1.Node import Node
>>> print pack1.Node, type(pack1.Node)
<module pack1.Node at 513138> org.python.core.PyModule
Jython 2.0alpha2 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> from pawt import swing
>>> swing
<java package javax.swing at 4653845>
>>> from pawt import swing
>>> swing
<java package javax.swing at 4653845>
>>>
regards, Samuele Pedroni.
|