Title: PyModule loses visibility of attributes
Type: behaviour Severity: major
Components: Core Versions: Jython 2.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: babelmania, fwierzbicki, mlhetland, zyasoft
Priority: high Keywords:

Created on 2010-09-14.12:49:43 by babelmania, last changed 2013-02-26.19:08:35 by fwierzbicki.

msg6064 (view) Author: Jorgo Bakker (babelmania) Date: 2010-09-14.12:49:41
Whenever mixing Jython and Java class in the same package structure and the Java class is not explicitly mentioned in, the module fails to find it in subsequent import calls.

from foo import bar // OK
from foo import Foo // ERROR

(Yes, we are able to mix java and jython code within the same structure since Jython 2.1 and managed to make it work under Jython 2.5.1 as well)

This is due to the fact that an PyModule is initialized once but  incomplete. Rather than to do a full initialization one could simply fix this by adding the following code to PyModule.

    public PyObject __findattr_ex__(String name) {
        PyObject attr=super.__findattr_ex__(name);
        if (attr!=null)
            return attr;
        return impAttr(name);

Problem found in 2.5.1 and 2.5.2b2
msg6065 (view) Author: Jorgo Bakker (babelmania) Date: 2010-09-14.12:50:25
Raised it to major, as I would /really/ like to see this end up in 2.5.2 :)
msg6066 (view) Author: Jorgo Bakker (babelmania) Date: 2010-09-14.12:53:17
Sorry, I did not complete the explanation
The above package structure would have been:

  foo/ # empty, only there primarily for namespace reasons
msg6067 (view) Author: Jim Baker (zyasoft) Date: 2010-09-14.15:15:44
Sounds reasonable, a minimally scoped fix. Marked high to be part of 2.5.2rc1

An apparent duplicate of #1464, which I recently closed because we didn't have a good idea of what to do here in terms of resolving the loading. Now we do. #1464 also a test case we potentially can leverage.

We will use this issue to track. Moving nosy list here too.
msg6173 (view) Author: Jim Baker (zyasoft) Date: 2010-10-16.05:24:38
Applied patch in r7151. Marked pending since it still needs a unit test however, hopefully I will have time before 2.5.2rc1, but better to get it in now.
msg6174 (view) Author: Jorgo Bakker (babelmania) Date: 2010-10-16.16:24:14
Much appreciated!
msg6520 (view) Author: Jorgo Bakker (babelmania) Date: 2011-05-04.12:34:02
Hi Jim,

I noticed that the code ended up in Jython 2.5.2.

What stops you to close the issue: test-harness?

cheers - Jorgo
msg7808 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-26.19:08:35
Looks like this can be closed.
Date User Action Args
2013-02-26 19:08:35fwierzbickisetstatus: pending -> closed
messages: + msg7808
2013-02-26 19:08:17fwierzbickisetversions: + Jython 2.5, - 2.5.2b1
2011-05-04 12:34:02babelmaniasetmessages: + msg6520
2010-10-16 16:24:16babelmaniasetmessages: + msg6174
2010-10-16 05:24:40zyasoftsetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg6173
2010-09-14 15:15:45zyasoftsettitle: PyModule looses visibility of attributes -> PyModule loses visibility of attributes
nosy: + mlhetland, fwierzbicki, zyasoft
messages: + msg6067
priority: high
assignee: zyasoft
resolution: accepted
2010-09-14 12:53:18babelmaniasetmessages: + msg6066
2010-09-14 12:50:26babelmaniasetmessages: + msg6065
severity: normal -> major
2010-09-14 12:49:43babelmaniacreate