From: <pj...@us...> - 2009-10-04 23:26:14
|
Revision: 6839 http://jython.svn.sourceforge.net/jython/?rev=6839&view=rev Author: pjenvey Date: 2009-10-04 23:25:51 +0000 (Sun, 04 Oct 2009) Log Message: ----------- only abspath module __file__s. the only other type having __file__ here is javapackage and their jar paths are already canonicalized by packagecache. saves maybe 150ms off startup Modified Paths: -------------- trunk/jython/Lib/site.py Modified: trunk/jython/Lib/site.py =================================================================== --- trunk/jython/Lib/site.py 2009-10-04 22:31:22 UTC (rev 6838) +++ trunk/jython/Lib/site.py 2009-10-04 23:25:51 UTC (rev 6839) @@ -60,6 +60,7 @@ import sys import os +import types import __builtin__ @@ -73,8 +74,10 @@ def abs__file__(): """Set all module' __file__ attribute to an absolute path""" for m in sys.modules.values(): - if hasattr(m, '__loader__'): - continue # don't mess with a PEP 302-supplied __file__ + if not isinstance(m, types.ModuleType) or hasattr(m, '__loader__'): + # only modules need the abspath in Jython. and don't mess + # with a PEP 302-supplied __file__ + continue f = getattr(m, '__file__', None) if f is None: continue This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |