Message10794

Author tcoker
Recipients tcoker
Date 2016-02-26.20:21:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456518114.47.0.850404712378.issue2480@psf.upfronthosting.co.za>
In-reply-to
Content
a)  for i in range(100000):
        from org.python import Version

b)  for i in range(100000):
        import org.python.Verion as Version

a) is massively slower than b).

Looks like the problem is the below from imp.java which makes it attempt to load the nonexistent org.python.__path__ because __path__ is never set on the java package object.

    private static void ensureFromList(PyObject mod, PyObject fromlist, String name,
                                       boolean recursive) {
            if (mod.__findattr__("__path__") == null) {
                return;
            }

Stack trace showing the class load:

	at org.python.core.Py.loadAndInitClass(Py.java:991)
	at org.python.core.Py.findClassInternal(Py.java:926)
	at org.python.core.Py.findClassEx(Py.java:977)
	at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:133)
	at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:33)
	at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:122)
	at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:134)
	at org.python.core.PyObject.__findattr__(PyObject.java:946)
	at org.python.core.imp.ensureFromList(imp.java:997)
	at org.python.core.imp.ensureFromList(imp.java:992)
	at org.python.core.imp.import_module_level(imp.java:986)
	at org.python.core.imp.importName(imp.java:1062)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
	at org.python.core.PyObject.__call__(PyObject.java:431)
	at org.python.core.__builtin__.__import__(__builtin__.java:1232)
	at org.python.core.imp.importFromAs(imp.java:1156)
	at org.python.core.imp.importFrom(imp.java:1132)
History
Date User Action Args
2016-02-26 20:21:54tcokersetrecipients: + tcoker
2016-02-26 20:21:54tcokersetmessageid: <1456518114.47.0.850404712378.issue2480@psf.upfronthosting.co.za>
2016-02-26 20:21:54tcokerlinkissue2480 messages
2016-02-26 20:21:53tcokercreate