Message6521

Author mhagger
Recipients curtis, edanuff, mhagger, niall_kelly, ttsounis
Date 2011-05-04.17:03:24
SpamBayes Score 1.59213e-10
Marked as misclassified No
Message-id <1304528605.28.0.670418396482.issue1878866@psf.upfronthosting.co.za>
In-reply-to
Content
In either 2.2.1 or in 2.6a0+ (trunk r7292) I am usually successful importing from a mixed directory.  But in both of those versions I see an ImportError in the following, more specific scenario.  When the current directory contains the following files:

    a/b/Foo.class
    a/__init__.py
    a/b/__init__.py
    a/b/Bar.py

then importing Foo fails with an ImportError; e.g., when run via

    jython -c 'from a.b import Foo'

or

    jython -c 'import a.b.Foo'

However, if I add a file a/Foobar.class, then both of the imports succeed.

The problem seems to be in org.python.core.packagecache.PathPackageManager.  In particular, there seems to be an assumption in PackageExistsFileFilter that a directory is pure Python if it includes Python code but no Java code, even if one of its subdirectories includes Java code.

I will attach a tar file that illustrates the problem; simply unpack it in a clean directory then run one of the jython commands as shown above.  The tarball also includes some scripts for playing around with variations on the theme.  Let me know if you need more information.
History
Date User Action Args
2011-05-04 17:03:25mhaggersetmessageid: <1304528605.28.0.670418396482.issue1878866@psf.upfronthosting.co.za>
2011-05-04 17:03:25mhaggersetrecipients: + mhagger, niall_kelly, curtis, ttsounis, edanuff
2011-05-04 17:03:25mhaggerlinkissue1878866 messages
2011-05-04 17:03:24mhaggercreate