From: Samuele P. <ped...@us...> - 2001-05-28 22:43:24
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv11143 Modified Files: imp.java Log Message: fix for bug #426023 from import *: ign __ vs. _ and __all__ . Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -r2.42 -r2.43 *** imp.java 2001/05/27 18:49:15 2.42 --- imp.java 2001/05/28 22:43:21 2.43 *************** *** 615,630 **** getStarArg()); PyObject names; if (module instanceof PyJavaPackage) names = ((PyJavaPackage)module).fillDir(); else { PyObject __all__ = module.__findattr__("__all__"); ! names = (__all__ != null) ? __all__ : module.__dir__(); } ! loadNames(names, module, frame.getf_locals()); } private static void loadNames(PyObject names, PyObject module, ! PyObject locals) { int i=0; --- 615,635 ---- getStarArg()); PyObject names; + boolean filter = false; if (module instanceof PyJavaPackage) names = ((PyJavaPackage)module).fillDir(); else { PyObject __all__ = module.__findattr__("__all__"); ! if (__all__ != null) names = __all__; ! else { ! names = module.__dir__(); ! filter = true; ! } } ! loadNames(names, module, frame.getf_locals(), filter); } private static void loadNames(PyObject names, PyObject module, ! PyObject locals, boolean filter) { int i=0; *************** *** 632,636 **** while ((name=names.__finditem__(i++)) != null) { String sname = ((PyString)name).internedString(); ! if (sname.startsWith("__")) { continue; } else { --- 637,641 ---- while ((name=names.__finditem__(i++)) != null) { String sname = ((PyString)name).internedString(); ! if (filter && sname.startsWith("_")) { continue; } else { |