From: Finn B. <bc...@us...> - 2001-07-29 14:59:16
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv23530/org/python/core Modified Files: imp.java Log Message: Patch [ #444911 ] which fixes bug #444292 local var binding overrides fix Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** imp.java 2001/07/25 22:01:14 2.52 --- imp.java 2001/07/29 14:59:13 2.53 *************** *** 13,17 **** public class imp { ! public static final int APIVersion = 8; private imp() { ; } --- 13,17 ---- public class imp { ! public static final int APIVersion = 9; private imp() { ; } *************** *** 620,635 **** * is executed. */ ! public static void importOne(String mod, PyFrame frame) { //System.out.println("importOne(" + mod + ")"); PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.f_locals, Py.EmptyTuple); ! int dot = mod.indexOf('.'); if (dot != -1) { mod = mod.substring(0, dot).intern(); ! } //System.err.println("mod: "+mod+", "+dot); ! frame.setlocal(mod, module); } --- 620,635 ---- * is executed. */ ! public static PyObject importOne(String mod, PyFrame frame) { //System.out.println("importOne(" + mod + ")"); PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.getf_locals(), Py.EmptyTuple); ! /*int dot = mod.indexOf('.'); if (dot != -1) { mod = mod.substring(0, dot).intern(); ! }*/ //System.err.println("mod: "+mod+", "+dot); ! return module; } *************** *** 638,648 **** * "import spam as foo" is executed. */ ! public static void importOneAs(String mod, String asname, PyFrame frame) { //System.out.println("importOne(" + mod + ")"); PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.f_locals, getStarArg()); ! frame.setlocal(asname, module); } --- 638,649 ---- * "import spam as foo" is executed. */ ! public static PyObject importOneAs(String mod, PyFrame frame) { //System.out.println("importOne(" + mod + ")"); PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.getf_locals(), getStarArg()); ! // frame.setlocal(asname, module); ! return module; } *************** *** 651,656 **** * "from spam.eggs import foo, bar" is executed. */ ! public static void importFrom(String mod, String[] names, PyFrame frame) { ! importFromAs(mod, names, names, frame); } --- 652,657 ---- * "from spam.eggs import foo, bar" is executed. */ ! public static PyObject[] importFrom(String mod, String[] names, PyFrame frame) { ! return importFromAs(mod, names, null, frame); } *************** *** 659,663 **** * "from spam.eggs import foo as spam" is executed. */ ! public static void importFromAs(String mod, String[] names, String[] asnames, PyFrame frame) { --- 660,664 ---- * "from spam.eggs import foo as spam" is executed. */ ! public static PyObject[] importFromAs(String mod, String[] names, String[] asnames, PyFrame frame) { *************** *** 673,684 **** PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.f_locals, new PyTuple(pynames)); for (int i=0; i<names.length; i++) { PyObject submod = module.__findattr__(names[i]); if (submod == null) throw Py.ImportError("cannot import name " + names[i]); ! frame.setlocal(asnames[i], submod); } } --- 674,687 ---- PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.getf_locals(), new PyTuple(pynames)); + PyObject[] submods = new PyObject[names.length]; for (int i=0; i<names.length; i++) { PyObject submod = module.__findattr__(names[i]); if (submod == null) throw Py.ImportError("cannot import name " + names[i]); ! submods[i] = submod; } + return submods; } *************** *** 699,703 **** PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.f_locals, getStarArg()); PyObject names; --- 702,706 ---- PyObject module = __builtin__.__import__(mod, frame.f_globals, ! frame.getf_locals(), getStarArg()); PyObject names; |