You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(107) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(76) |
Feb
(125) |
Mar
(72) |
Apr
(13) |
May
(18) |
Jun
(12) |
Jul
(129) |
Aug
(47) |
Sep
(1) |
Oct
(36) |
Nov
(128) |
Dec
(124) |
2002 |
Jan
(59) |
Feb
|
Mar
(14) |
Apr
(14) |
May
(72) |
Jun
(9) |
Jul
(3) |
Aug
(5) |
Sep
(18) |
Oct
(65) |
Nov
(28) |
Dec
(12) |
2003 |
Jan
(10) |
Feb
(2) |
Mar
(4) |
Apr
(33) |
May
(21) |
Jun
(9) |
Jul
(29) |
Aug
(34) |
Sep
(4) |
Oct
(8) |
Nov
(15) |
Dec
(4) |
2004 |
Jan
(26) |
Feb
(12) |
Mar
(11) |
Apr
(9) |
May
(7) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(2) |
Feb
(72) |
Mar
(16) |
Apr
(39) |
May
(48) |
Jun
(97) |
Jul
(57) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(100) |
Dec
(24) |
2006 |
Jan
(15) |
Feb
(34) |
Mar
(33) |
Apr
(31) |
May
(79) |
Jun
(64) |
Jul
(41) |
Aug
(64) |
Sep
(31) |
Oct
(46) |
Nov
(55) |
Dec
(37) |
2007 |
Jan
(32) |
Feb
(61) |
Mar
(11) |
Apr
(58) |
May
(46) |
Jun
(30) |
Jul
(94) |
Aug
(93) |
Sep
(86) |
Oct
(69) |
Nov
(125) |
Dec
(177) |
2008 |
Jan
(169) |
Feb
(97) |
Mar
(74) |
Apr
(113) |
May
(120) |
Jun
(334) |
Jul
(215) |
Aug
(237) |
Sep
(72) |
Oct
(189) |
Nov
(126) |
Dec
(160) |
2009 |
Jan
(180) |
Feb
(45) |
Mar
(98) |
Apr
(140) |
May
(151) |
Jun
(71) |
Jul
(107) |
Aug
(119) |
Sep
(73) |
Oct
(121) |
Nov
(14) |
Dec
(6) |
2010 |
Jan
(13) |
Feb
(9) |
Mar
(10) |
Apr
(64) |
May
(3) |
Jun
(16) |
Jul
(7) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(77) |
Apr
(11) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Finn B. <bc...@us...> - 2001-06-04 10:43:44
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv28938 Modified Files: Options.java imp.java Log Message: Support for case sensitive imports on case-ignoring filesystem (like windows). Index: Options.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Options.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** Options.java 2001/03/04 18:04:31 2.7 --- Options.java 2001/06/04 10:42:59 2.8 *************** *** 74,77 **** --- 74,85 ---- public static String proxyDebugDirectory = null; + /** + * If true, Jython will use the first module found on sys.path + * where java File.isFile() returns true. Setting this to true + * have no effect on unix-type filesystems. On Windows/HPS+ + * systems setting it to true will enable Jython-2.0 behaviour. + */ + public static boolean caseok = false; + // // ####### END OF OPTIONS *************** *** 144,147 **** --- 152,159 ---- prop+"'"); } + + Options.caseok = + getBooleanOption("options.caseok", Options.pollStandardIn); + // additional initializations which must happen after the registry // is guaranteed to be initialized. Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -r2.43 -r2.44 *** imp.java 2001/05/28 22:43:21 2.43 --- imp.java 2001/06/04 10:42:59 2.44 *************** *** 295,299 **** // First check for packages File dir = new File(dirName, name); ! if (dir.isDirectory() && (new File(dir, "__init__.py").isFile() || new File(dir, "__init__$py.class").isFile())) --- 295,299 ---- // First check for packages File dir = new File(dirName, name); ! if (dir.isDirectory() && caseok(dir, name) && (new File(dir, "__init__.py").isFile() || new File(dir, "__init__$py.class").isFile())) *************** *** 314,319 **** Py.writeDebug("import", "trying source " + pyFile.getPath()); ! if (pyFile.isFile()) { ! if (classFile.isFile()) { Py.writeDebug("import", "trying precompiled " + classFile.getPath()); --- 314,319 ---- Py.writeDebug("import", "trying source " + pyFile.getPath()); ! if (pyFile.isFile() && caseok(pyFile, pyName)) { ! if (classFile.isFile() && caseok(classFile, className)) { Py.writeDebug("import", "trying precompiled " + classFile.getPath()); *************** *** 334,338 **** // If no source, try loading precompiled Py.writeDebug("import", "trying " + classFile.getPath()); ! if (classFile.isFile()) { return createFromPyClass(modName, makeStream(classFile), false, classFile.getPath()); --- 334,338 ---- // If no source, try loading precompiled Py.writeDebug("import", "trying " + classFile.getPath()); ! if (classFile.isFile() && caseok(classFile, className)) { return createFromPyClass(modName, makeStream(classFile), false, classFile.getPath()); *************** *** 340,343 **** --- 340,354 ---- } return null; + } + + private static boolean caseok(File file, String filename) { + if (Options.caseok) + return true; + try { + File canFile = new File(file.getCanonicalPath()); + return filename.equals(canFile.getName()); + } catch (IOException exc) { + return false; + } } |
From: Samuele P. <ped...@us...> - 2001-05-31 18:16:58
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv15096 Modified Files: PyString.java Log Message: fixed some int(), long() minor bugs. Index: PyString.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyString.java,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -r2.43 -r2.44 *** PyString.java 2001/03/04 18:58:40 2.43 --- PyString.java 2001/05/31 18:16:55 2.44 *************** *** 1250,1267 **** if (sign == '-' || sign == '+') { b++; ! while (b < e && Character.isWhitespace(string.charAt(b))) ! b++; } - } ! if (base == 0 || base == 16) { ! if (string.charAt(b) == '0') { ! if (b < e-1 && string.charAt(b+1) == 'x') { ! if (base == 0) base = 16; ! b += 2; ! } else { ! if (base == 0) ! base = 8; } } --- 1250,1265 ---- if (sign == '-' || sign == '+') { b++; ! while (b < e && Character.isWhitespace(string.charAt(b))) b++; } ! if (base == 0 || base == 16) { ! if (string.charAt(b) == '0') { ! if (b < e-1 && (string.charAt(b+1) == 'x' || string.charAt(b+1) == 'X')) { base = 16; ! b += 2; ! } else { ! if (base == 0) ! base = 8; ! } } } *************** *** 1313,1330 **** if (sign == '-' || sign == '+') { b++; ! while (b < e && Character.isWhitespace(str.charAt(b))) ! b++; } ! } ! if (base == 0) { ! if (str.charAt(b) != '0') ! base = 10; ! else if (str.charAt(b+1) == 'x' || str.charAt(b+1) == 'X') { ! base = 16; ! b += 2; ! } else ! base = 8; } if (base < 2 || base > 36) throw Py.ValueError("invalid base for long literal:" + base); --- 1311,1333 ---- if (sign == '-' || sign == '+') { b++; ! while (b < e && Character.isWhitespace(str.charAt(b))) b++; } ! ! if (base == 0 || base == 16) { ! if (string.charAt(b) == '0') { ! if (b < e-1 && (string.charAt(b+1) == 'x' || string.charAt(b+1) == 'X')) { ! base = 16; ! b += 2; ! } else { ! if (base == 0) ! base = 8; ! } ! } ! } } + if (base == 0) + base = 10; + if (base < 2 || base > 36) throw Py.ValueError("invalid base for long literal:" + base); *************** *** 1341,1347 **** return new PyLong(bi); } catch (NumberFormatException exc) { ! throw Py.ValueError("invalid literal for __int__: "+str); } catch (StringIndexOutOfBoundsException exc) { ! throw Py.ValueError("invalid literal for __int__: "+str); } } --- 1344,1350 ---- return new PyLong(bi); } catch (NumberFormatException exc) { ! throw Py.ValueError("invalid literal for __long__: "+str); } catch (StringIndexOutOfBoundsException exc) { ! throw Py.ValueError("invalid literal for __long__: "+str); } } |
From: Finn B. <bc...@us...> - 2001-05-30 17:56:25
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv23863 Modified Files: javac.py Log Message: compile(): Add quotes to the classpath value, but only on windows and java1.1. In JDK1.2 the VM will add the quotes itself. Index: javac.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/javac.py,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -r2.12 -r2.13 *** javac.py 2001/02/07 16:52:42 2.12 --- javac.py 2001/05/30 08:44:25 2.13 *************** *** 77,81 **** cpath.append(sourcedir) cpath.extend(sys.path) ! cpath = '"%s"' % sep.join(cpath) cmd.extend([cpathopt, cpath]) cmd.extend(files) --- 77,84 ---- cpath.append(sourcedir) cpath.extend(sys.path) ! cpath = sep.join(cpath) ! if System.getProperty("os.name")[:7] == 'Windows' and \ ! System.getProperty("java.version") < "1.2": ! cpath = '"%s"' % cpath cmd.extend([cpathopt, cpath]) cmd.extend(files) |
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 { |
From: Finn B. <bc...@us...> - 2001-05-28 16:56:40
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv25129 Modified Files: registry Log Message: Add comment and example use of python.console. Index: registry =================================================================== RCS file: /cvsroot/jython/jython/registry,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -r2.12 -r2.13 *** registry 2000/12/16 16:43:33 2.12 --- registry 2001/05/28 16:56:37 2.13 *************** *** 35,38 **** --- 35,42 ---- python.deprecated.keywordMangling = false + # Setting this to the name of different console class, new console + # features can be enabled. Readline support is such an example + #python.console=org.python.util.ReadlineConsole + # Setting this to true will cause the console to poll standard in # This might be helpful on systems without system-level threads |
From: Samuele P. <ped...@us...> - 2001-05-27 18:50:59
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv24686 Modified Files: BaseEvaluator.py ObjectFactory.py PythonModule.py PythonVisitor.py SimpleCompiler.py compile.py Log Message: ** jythonc nested scopes support ** should also solve #222834 import * into locals Index: BaseEvaluator.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/BaseEvaluator.py,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -r2.9 -r2.10 *** BaseEvaluator.py 2000/11/10 15:06:56 2.9 --- BaseEvaluator.py 2001/05/27 18:50:56 2.10 *************** *** 89,93 **** if node.id == JJTNAME: return self.set_name(node.getInfo(), value) ! elif node.id == JJTLIST or node.id == JJTTUPLE: return self.set_list(nodeToList(node), value) elif node.id == JJTINDEX_OP: --- 89,93 ---- if node.id == JJTNAME: return self.set_name(node.getInfo(), value) ! elif node.id == JJTLIST or node.id == JJTFPLIST or node.id == JJTTUPLE: return self.set_list(nodeToList(node), value) elif node.id == JJTINDEX_OP: Index: ObjectFactory.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/ObjectFactory.py,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** ObjectFactory.py 2001/03/22 20:07:08 2.7 --- ObjectFactory.py 2001/05/27 18:50:56 2.8 *************** *** 31,40 **** return Object(ns.getNew(), ns) ! def makeFunction(self, name, args, body, doc=None): ! func = PyFunction(self.parent, self, name, args, body, doc) return Object(func.getNew(), func) ! def makeClass(self, name, bases, body, doc=None): ! cls = PyClass(self.parent, self, name, bases, body, doc) # Yuck! We can't call getNew() before all modules have been analyzed. class DelayGen: --- 31,40 ---- return Object(ns.getNew(), ns) ! def makeFunction(self, name, def_compiler, scope, body, doc=None): ! func = PyFunction(self, name, def_compiler, scope, body, doc) return Object(func.getNew(), func) ! def makeClass(self, name, bases, def_compiler, scope, body, doc=None): ! cls = PyClass(self, name, bases, def_compiler, scope, body, doc) # Yuck! We can't call getNew() before all modules have been analyzed. class DelayGen: *************** *** 105,119 **** return Object(code, Generic) ! def makeFunctionFrame(self): ! return SimpleCompiler.LocalFrame(self.parent) - def makeClassFrame(self): - return SimpleCompiler.LocalFrame(self.parent, - SimpleCompiler.DynamicStringReference) - - def getCompiler(self, frame): - return SimpleCompiler.SimpleCompiler(self.parent.module, self, frame, - self.parent.options) - class FixedObject(PyObject): --- 105,115 ---- return Object(code, Generic) ! def getCompiler(self, parent_compiler, frameCtr, scope): ! return SimpleCompiler.SimpleCompiler(self.parent.module, self, ! parent = parent_compiler, ! frameCtr = frameCtr, ! scope = scope, ! options = self.parent.options) class FixedObject(PyObject): *************** *** 132,166 **** class PyFunction(FixedObject): ! def __init__(self, parent, factory, name, args, body, doc=None): self.name = name self.factory = factory ! self.parent = parent ! self.args = args self.body = body self.doc = doc def getNew(self): ! globals = jast.GetInstanceAttribute(self.parent.frame.frame, "f_globals") pycode = self.makeCode() ! return jast.New("PyFunction", ! [globals, PyObjectArray(self.args.defaults), pycode]) ! def makeCode(self): ! # Don't handle a,b style args yet ! init_code = [] ! frame = self.parent.frame # Add args to funcframe ! funcframe = self.factory.makeFunctionFrame() ! for argname in self.args.names: ! funcframe.setname(argname, self.factory.makePyObject(None)) ! #funcframe.addlocal(argname) # Parse the body ! comp = self.factory.getCompiler(funcframe) ! code = jast.Block([comp.parse(self.body)]) # Set up a code object ! self.pycode = self.parent.module.getCodeConstant( ! self.name, self.args, funcframe.getlocals(), code) ! self.frame = funcframe return self.pycode --- 128,167 ---- class PyFunction(FixedObject): ! def __init__(self, factory, name, def_compiler,scope, body, doc=None): self.name = name self.factory = factory ! self.def_compiler = def_compiler ! self.scope = scope self.body = body self.doc = doc def getNew(self): ! globals = jast.GetInstanceAttribute(self.def_compiler.frame.frame, "f_globals") pycode = self.makeCode() ! defaults = [ d.visit(self.def_compiler.visitor) for d in self.scope.ac.defaults ] ! clos = self.def_compiler.frame.makeClosure(self.scope) ! ctrargs = [globals, PyObjectArray(defaults), pycode] ! if clos: ! ctrargs.append(PyObjectArray(clos)) ! return jast.New("PyFunction", ctrargs) ! def makeCode(self): # now handles a,b style args too # Add args to funcframe ! ac = self.scope.ac # Parse the body ! comp = self.factory.getCompiler(self.def_compiler,SimpleCompiler.FunctionFrame,self.scope) ! for argname in ac.names: ! comp.frame.setname(argname, self.factory.makePyObject(None)) ! ! tree = self.body ! if ac.init_code.numChildren > 0: ! ac.init_code.jjtAddChild(tree, ac.init_code.numChildren) ! tree = ac.init_code ! code = jast.Block([comp.parse(tree)]) # Set up a code object ! self.pycode = self.def_compiler.top_compiler.module.getCodeConstant( ! self.name, code, comp.frame) ! self.frame = comp.frame return self.pycode *************** *** 168,176 **** class PyClass(FixedObject): ! def __init__(self, parent, factory, name, bases, body, doc=None): self.name = name - self.parent = parent self.factory = factory self.bases = bases self.body = body self.doc = doc --- 169,178 ---- class PyClass(FixedObject): ! def __init__(self, factory, name, bases, def_compiler, scope, body, doc=None): self.name = name self.factory = factory self.bases = bases + self.def_compiler = def_compiler + self.scope = scope self.body = body self.doc = doc *************** *** 184,187 **** --- 186,193 ---- args.append(jast.Identifier("%s.class" % self.proxyname)) + clos = self.def_compiler.frame.makeClosure(self.scope) + if clos: + args.append(PyObjectArray(clos)) + return jast.InvokeStatic("Py", "makeClass", args) *************** *** 241,253 **** def makeCode(self): ! classframe = self.factory.makeClassFrame() ! comp = self.factory.getCompiler(classframe) code = jast.Block([comp.parse(self.body), ! jast.Return(jast.Invoke(classframe.frame, "getf_locals", []))]) ! self.frame = classframe ! self.pycode = self.parent.module.getCodeConstant( ! self.name, None, ! classframe.getlocals(), code) return self.pycode --- 247,258 ---- def makeCode(self): ! comp = self.factory.getCompiler(self.def_compiler, ! SimpleCompiler.ClassFrame, self.scope) code = jast.Block([comp.parse(self.body), ! jast.Return(jast.Invoke(comp.frame.frame, "getf_locals", []))]) ! self.frame = comp.frame ! self.pycode = self.def_compiler.top_compiler.module.getCodeConstant( ! self.name, code, comp.frame) return self.pycode Index: PythonModule.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonModule.py,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** PythonModule.py 2000/11/20 21:55:49 2.13 --- PythonModule.py 2001/05/27 18:50:56 2.14 *************** *** 5,13 **** import jast import java, org - from PythonVisitor import Arguments EMPTYSTRING = '' """ --- 5,14 ---- import jast import java, org EMPTYSTRING = '' + from org.python.core.PyTableCode import CO_OPTIMIZED,CO_NESTED + """ *************** *** 44,47 **** --- 45,55 ---- + + def StringArrayOrNull(strs): + if strs: + return jast.StringArray(strs) + else: + return jast.Null + class PythonInner: def __init__(self, parent): *************** *** 95,104 **** return self.getConstant(value, code, "s") ! def getCodeConstant(self, name, args, locals, code): ! if args is None: ! args = Arguments([]) label = "c$%d_%s" % (len(self.codes), legalJavaName(name)) ret = jast.Identifier(label) ! self.codes.append( (label, name, args, locals, code) ) return ret --- 103,110 ---- return self.getConstant(value, code, "s") ! def getCodeConstant(self, name, code, frame): label = "c$%d_%s" % (len(self.codes), legalJavaName(name)) ret = jast.Identifier(label) ! self.codes.append( (label, name, code, frame) ) return ret *************** *** 119,135 **** self.constants.append(["PyFunctionTable", self.getFunctionTable(), jast.New(self.name, [])]) - for label, name, args, locals, code in self.codes: funcid = self.addFunctionCode(name, code) arglist = keyworddict = jast.False ! if args.arglist: arglist = jast.True ! if args.keyworddict: keyworddict = jast.True ! names = jast.StringArray(locals) ! cargs = [jast.IntegerConstant(len(args.names)), names, jast.StringConstant(self.filename), --- 125,146 ---- self.constants.append(["PyFunctionTable", self.getFunctionTable(), jast.New(self.name, [])]) + + for label, name, code, frame in self.codes: + code = frame.toCellPrepend(code) funcid = self.addFunctionCode(name, code) arglist = keyworddict = jast.False ! if frame.args_arglist(): arglist = jast.True ! if frame.args_keyworddict(): keyworddict = jast.True ! names = jast.StringArray(frame.getnames()) ! cellnames = StringArrayOrNull(frame.getcellnames()) ! freenames = StringArrayOrNull(frame.getfreenames()) ! npurecell = frame.get_npurecell() ! cargs = [jast.IntegerConstant(frame.args_count()), names, jast.StringConstant(self.filename), *************** *** 138,142 **** keyworddict, self.getFunctionTable(), ! jast.IntegerConstant(funcid)] newcode = jast.InvokeStatic("Py", "newCode", cargs) self.constants.append(("PyCode", jast.Identifier(label), newcode)) --- 149,157 ---- keyworddict, self.getFunctionTable(), ! jast.IntegerConstant(funcid), ! cellnames, ! freenames, ! jast.IntegerConstant(npurecell), ! jast.IntegerConstant((frame.opt_globals and CO_OPTIMIZED) | (frame.scope.nested_scopes and CO_NESTED))] newcode = jast.InvokeStatic("Py", "newCode", cargs) self.constants.append(("PyCode", jast.Identifier(label), newcode)) *************** *** 184,189 **** def addMain(self, code, cc): ! self.mainCode = self.getCodeConstant("main", Arguments([]), ! cc.frame.getlocals(), code) def dumpMain(self): --- 199,203 ---- def addMain(self, code, cc): ! self.mainCode = self.getCodeConstant("main", code, cc.frame) def dumpMain(self): *************** *** 302,307 **** return self.pyinner.getStringConstant(value) ! def getCodeConstant(self, name, args, locals, code): ! return self.pyinner.getCodeConstant(name, args, locals, code) def addFunctionCode(self, name, code): --- 316,321 ---- return self.pyinner.getStringConstant(value) ! def getCodeConstant(self, name, code, frame): ! return self.pyinner.getCodeConstant(name, code, frame) def addFunctionCode(self, name, code): Index: PythonVisitor.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonVisitor.py,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** PythonVisitor.py 2000/11/10 15:08:48 2.7 --- PythonVisitor.py 2001/05/27 18:50:56 2.8 *************** *** 5,8 **** --- 5,10 ---- from org.python.parser import SimpleNode + from org.python.compiler import Future + comp_ops = {JJTLESS_CMP : 'lt', *************** *** 34,76 **** - class Arguments(Visitor): - def __init__(self, parent, argslist=None): - self.arglist = 0 - self.keyworddict = 0 - self.names = [] - self.defaults = [] - - self.parent = parent - - if argslist is not None: - argslist.visit(self) - - def varargslist(self, node): - for i in range(node.numChildren): - node.getChild(i).visit(self) - - def ExtraArgList(self, node): - self.arglist = 1 - self.names.append(node.getChild(0).visit(self)) - - def ExtraKeywordList(self, node): - self.keyworddict = 1 - self.names.append(node.getChild(0).visit(self)) - - def defaultarg(self, node): - name = node.getChild(0).visit(self) - self.names.append(name) - if node.numChildren > 1: - self.defaults.append(node.getChild(1).visit(self.parent)) - - def fplist(self, node): - return 'ugh' - pass # ??? - - def Name(self, node): - return node.getInfo() - - - def getDocString(suite): if suite.numChildren > 0: --- 36,39 ---- *************** *** 165,168 **** --- 128,132 ---- def ImportFrom(self, node): + Future.checkFromFuture(node) # future stmt support self.startnode(node) if node.numChildren > 1: *************** *** 520,542 **** doc = getDocString(Body) - if node.numChildren > 2: - args = Arguments(self, node.getChild(1)) - else: - args = Arguments(self) ! return self.walker.funcdef(funcname, args, Body, doc) def lambdef(self, node): Body = node.getChild(node.numChildren-1) - if node.numChildren > 1: - args = Arguments(self, node.getChild(0)) - else: - args = Arguments(self) - retBody = SimpleNode(JJTRETURN_STMT) retBody.jjtAddChild(Body, 0) ! return self.walker.lambdef(args, retBody) def classdef(self, node): --- 484,497 ---- doc = getDocString(Body) ! return self.walker.funcdef(funcname, node.scope, Body, doc) def lambdef(self, node): Body = node.getChild(node.numChildren-1) retBody = SimpleNode(JJTRETURN_STMT) retBody.jjtAddChild(Body, 0) ! return self.walker.lambdef(node.scope, retBody) def classdef(self, node): *************** *** 551,553 **** bases.append(node.getChild(i).visit(self)) ! return self.walker.classdef(name, bases, suite, doc) --- 506,508 ---- bases.append(node.getChild(i).visit(self)) ! return self.walker.classdef(name, bases, node.scope, suite, doc) Index: SimpleCompiler.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/SimpleCompiler.py,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** SimpleCompiler.py 2001/02/25 15:37:21 2.13 --- SimpleCompiler.py 2001/05/27 18:50:56 2.14 *************** *** 2,6 **** from BaseEvaluator import BaseEvaluator - from PythonVisitor import Arguments import jast import ImportName --- 2,5 ---- *************** *** 8,127 **** COMMASPACE = ', ' ! ! class Reference: ! def __init__(self, frame, name): ! self.iframe = frame.frame ! self.frame = frame ! self.locals = frame.locals ! self.name = name ! self.value = None ! self.init() ! ! def init(self): pass ! ! def noValue(self): ! raise NameError, 'try to get %s before set' % repr(self.name) ! ! def getValue(self): ! if self.value is None: ! return self.noValue() ! return self.value ! ! def setValue(self, value): ! if self.value is None: ! self.value = value.makeReference(self.getCode()) ! else: ! # Might want to try and merge types here... ! self.value = self.value.mergeWith(value) ! self.value.code = self.getCode() ! #PyObject(self.getCode(), None) ! return self.setCode(value) ! ! def delValue(self): ! #self.value = None ! return self.delCode() ! ! class DynamicIntReference(Reference): ! def init(self): ! self.ivalue = jast.IntegerConstant(len(self.locals)) ! ! def getCode(self): ! return jast.Invoke(self.iframe, "getlocal", (self.ivalue,)) ! ! def setCode(self, value): ! return jast.Invoke(self.iframe, "setlocal", ! (self.ivalue, value.asAny())) ! def delCode(self): ! return jast.Invoke(self.iframe, "dellocal", (self.ivalue,)) ! ! class DynamicStringReference(Reference): ! def init(self): ! self.ivalue = jast.StringConstant(self.name) ! ! def getCode(self): ! return jast.Invoke(self.iframe, "getname", (self.ivalue,)) ! ! def delCode(self): ! return jast.Invoke(self.iframe, "delname", (self.ivalue,)) ! ! def setCode(self, value): ! return jast.Invoke(self.iframe, "setlocal", ! (self.ivalue, value.asAny())) ! ! class DynamicStringReference2(DynamicStringReference): ! def setCode(self, value): ! return jast.Invoke(self.iframe, "setglobal", ! (self.ivalue, value.asAny())) ! ! def noValue(self): ! # Reference to builtin ! return self.frame.parent.factory.makePyObject(self.getCode()) ! ! class DynamicGlobalStringReference(Reference): ! def init(self): ! self.ivalue = jast.StringConstant(self.name) ! ! def getCode(self): ! return jast.Invoke(self.iframe, "getglobal", (self.ivalue,)) ! ! def delCode(self): ! return jast.Invoke(self.iframe, "delglobal", (self.ivalue,)) ! ! def setCode(self, value): ! return jast.Invoke(self.iframe, "setglobal", ! (self.ivalue, value.asAny())) ! ! def noValue(self): ! # Reference to builtin ! return self.frame.parent.factory.makePyObject(self.getCode()) ! ! class LocalFrame: ! def __init__(self, parent, newReference=DynamicIntReference): ! self.frame = jast.Identifier("frame") ! ! # This should only use SlowGlobals if the function uses ! # ImportAll or ExecStmt. If not it should use ! # parent.globalNamespace. ! ! #self.globalNamespace = SlowGlobals(parent) ! self.globalNamespace = parent.globalNamespace ! ! self.parent = parent ! self.newReference = newReference ! ! self.names = {} ! self.globals = {} ! self.locals = [] ! self.temporaries = {} def gettemps(self, type): --- 7,81 ---- COMMASPACE = ', ' + from org.python.compiler import ScopesCompiler, Future, CompilationContext + from org.python.compiler.ScopeConstants import * ! import warnings ! from org.python.parser import ParseException ! class LocalFrame: ! def __init__(self, compiler, scope=None): ! ! self.frame = jast.Identifier("frame") ! self.compiler = compiler + self.names = {} ! self.temporaries = {} ! self.scope = scope + self.fast_locals = 0 + self.opt_globals = 0 ! def setupClosure(self,nested_scope): ! nested_scope.setup_closure(self.scope) ! def makeClosure(self,nested_scope): ! freenames = nested_scope.freevars ! if len(freenames) == 0: return None ! clos = [] ! factory = self.compiler.factory ! for free in freenames: ! i = self.scope.tbl.get(free).env_index ! code = jast.Invoke(self.frame, "getclosure", [jast.IntegerConstant(i)]) ! clos.append(factory.makePyObject(code)) ! return clos ! ! def getnames(self): ! return self.scope.names ! ! def args_count(self): ! if self.scope.ac: ! return len(self.scope.ac.names) ! return 0 ! ! def args_arglist(self): ! return self.scope.ac and self.scope.ac.arglist ! ! def args_keyworddict(self): ! return self.scope.ac and self.scope.ac.keywordlist ! ! def getfreenames(self): ! return self.scope.freevars ! ! def getcellnames(self): ! return self.scope.cellvars ! ! def get_npurecell(self): ! return self.scope.jy_npurecell ! ! def toCellPrepend(self,code): ! scope = self.scope ! pre = [] ! for parmcell in scope.jy_paramcells: ! syminf = scope.tbl.get(parmcell) ! args = [jast.IntegerConstant(syminf.locals_index), ! jast.IntegerConstant(syminf.env_index)] ! pre.append(jast.Invoke(self.frame, "to_cell", args)) ! if not pre: return code ! pre.append(jast.BlankLine()) ! return jast.Block(jast.flatten([pre,code])) def gettemps(self, type): *************** *** 162,200 **** temps[index] = None ! def getname(self, name): ! if not self.names.has_key(name): ! return self.globalNamespace.getname(self, name) ! ref = self.getReference(name) ! return ref.getValue() ! def delname(self, name): ! if self.globals.has_key(name): ! return self.globalNamespace.delname(self, name) ! ref = self.getReference(name) ! return ref.delValue() ! def setname(self, name, value): ! if self.globals.has_key(name): ! return self.globalNamespace.setname(self, name, value) ! ref = self.getReference(name) ! return ref.setValue(value) ! ! def addglobal(self, name): ! self.globals[name] = 1 ! def addlocal(self, name): ! self.getReference(name) ! def getlocals(self): ! return self.locals ! def getReference(self, name): ! if self.names.has_key(name): ! return self.names[name] ! ret = self.newReference(self, name) ! self.names[name] = ret ! self.locals.append(name) ! return ret def getDeclarations(self): if len(self.temporaries) == 0: --- 116,203 ---- temps[index] = None ! def get_local_value(self,name): ! if self.names.has_key(name): return self.names[name] ! return None # ?? better to fail? when? ! ! def get_closure_value(self,name,up=0): ! if not up: ! syminf = self.scope.tbl.get(name) ! if syminf and syminf.flags&CELL: return self.get_local_value(name) ! return self.compiler.parent_compiler.frame.get_closure_value(name) ! ! def get_global_value(self,name): ! return self.compiler.top_compiler.frame.get_local_value(name) ! ! def get_name_value(self,name): ! if self.names.has_key(name): return self.names[name] ! return self.get_global_value(name) ! def set_global_value(self,name,value): ! self.compiler.top_compiler.frame.set_value(name,value) ! def set_value(self,name,value): ! if self.names.has_key(name): ! self.names[name] = self.names[name].mergeWith(value) ! return ! self.names[name] = value ! ! def delCode(self,method,ref): ! if type(ref) is type(""): ! ref = (jast.StringConstant(ref),) ! else: ! ref = (jast.IntegerConstant(ref),) ! return jast.Invoke(self.frame,method,ref) ! ! def getReference(self,value,method,ref): ! code = self.delCode(method,ref) ! if value: return value.makeReference(code) ! return self.compiler.factory.makePyObject(code) ! ! def setCode(self,method,ref,value): ! if type(ref) is type(""): ! args = (jast.StringConstant(ref),value.asAny()) ! else: ! args = (jast.IntegerConstant(ref),value.asAny()) ! return jast.Invoke(self.frame,method,args) ! def getglobal(self,name): ! return self.getReference(self.get_global_value(name),'getglobal',name) ! def getname(self, name): ! syminf = self.scope.tbl.get(name) ! if syminf: ! flags = syminf.flags ! if not self.scope.nested_scopes: flags &= ~FREE ! if flags&GLOBAL or self.opt_globals and not (flags&(BOUND|CELL|FREE)): ! return self.getglobal(name) ! if self.fast_locals: ! if flags&CELL: return self.getReference( ! self.get_closure_value(name),'getderef',syminf.env_index) ! if flags&BOUND: return self.getReference( ! self.get_local_value(name),'getlocal',syminf.locals_index) ! if flags&FREE and not flags&BOUND: return self.getReference( ! self.get_closure_value(name,up=1),'getderef',syminf.env_index) ! return self.getReference(self.get_name_value(name),'getname',name) ! ! def delname(self, name): ! syminf = self.scope.tbl.get(name) ! if syminf and syminf.flags&GLOBAL: return self.delCode('delglobal',name) ! if not self.fast_locals: return self.delCode('dellocal',name) ! if syminf.flags&CELL: raise NameError,"can not delete variable '%s' referenced in nested scope" % name ! return self.delCode('dellocal',syminf.locals_index) + def setname(self, name, value): + syminf = self.scope.tbl.get(name) + if syminf and syminf.flags&GLOBAL: + self.set_global_value(name,value) + return self.setCode('setglobal',name,value) + + self.set_value(name,value) + + if not self.fast_locals: return self.setCode('setlocal',name,value) + if syminf and syminf.flags&CELL: return self.setCode('setderef',syminf.env_index,value) + return self.setCode('setlocal',syminf.locals_index,value) + def getDeclarations(self): if len(self.temporaries) == 0: *************** *** 214,265 **** class GlobalFrame(LocalFrame): ! def __init__(self, parent): ! LocalFrame.__init__(self, parent) ! self.globalNamespace = parent.globalNamespace ! def getReference(self, name): ! return self.globalNamespace.getReference(self, name) ! ! ! class BasicGlobals: ! def __init__(self, parent, newReference=DynamicGlobalStringReference): ! self.names = {} ! self.newReference = newReference ! self.parent = parent ! ! def delname(self, frame, name): ! ref = self.getReference(frame, name) ! return ref.delValue() ! ! def getname(self, frame, name): ! ref = self.getReference(frame, name) ! return ref.getValue() ! ! def setname(self, frame, name, value): ! ref = self.getReference(frame, name) ! return ref.setValue(value) ! ! def getReference(self, frame, name): ! if self.names.has_key(name): ! return self.names[name] ! ret = self.newReference(frame, name) ! self.names[name] = ret ! return ret ! ! class SlowGlobals(BasicGlobals): ! def __init__(self, parent, newReference=DynamicStringReference2): ! self.names = {} ! self.newReference = newReference ! self.parent = parent ! class SimpleCompiler(BaseEvaluator): ! def __init__(self, module, factory, frame=None, options=None): BaseEvaluator.__init__(self) ! self.globalNamespace = BasicGlobals(self) ! if frame is None: frame = GlobalFrame(self) self.frame = frame self.module = module --- 217,250 ---- class GlobalFrame(LocalFrame): ! def __init__(self, compiler): ! LocalFrame.__init__(self, compiler) ! def setScope(self,scope): self.scope = scope ! class ClassFrame(LocalFrame): ! def getnames(self): ! return [] + class FunctionFrame(LocalFrame): + def __init__(self,compiler,scope): + LocalFrame.__init__(self,compiler,scope=scope) + self.fast_locals = 1 + self.opt_globals = not scope.exec and not scope.from_import_star ! class SimpleCompiler(BaseEvaluator, CompilationContext): ! def __init__(self, module, factory, parent=None, frameCtr=None, scope=None, ! options=None): BaseEvaluator.__init__(self) ! ! if parent is None: frame = GlobalFrame(self) + self.parent_compiler = None + self.top_compiler = self + else: + frame = frameCtr(self, scope=scope) + self.parent_compiler = parent + self.top_compiler = parent.top_compiler + self.frame = frame self.module = module *************** *** 274,278 **** --- 259,283 ---- return name in self.options.falsenames + def getFutures(self): + return self._futures + + def getFilename(self): + return self.module.filename + + def error(self,msg,err,node): + if not err: + try: + warnings.warn_explicit(msg,SyntaxWarning,self.getFilename(),node.beginLine) + return + except Exception,e: + if not isinstance(e,SyntaxWarning): raise e + raise ParseException(msg,node) + def parse(self, node): + if isinstance(self.frame,GlobalFrame): + futures = self._futures = Future() + futures.preprocessFutures(node,None) + ScopesCompiler(self).parse(node) + self.frame.setScope(node.scope) ret = BaseEvaluator.parse(self, node) #print 'parse', ret *************** *** 389,394 **** def global_stmt(self, names): - for name in names: - self.frame.addglobal(name) return jast.SimpleComment('global ' + COMMASPACE.join(names)) --- 394,397 ---- *************** *** 568,572 **** args.append(message.asAny()) ! return jast.If(self.name_const("__debug__").nonzero(), jast.InvokeStatic("Py", "assert", args)) --- 571,575 ---- args.append(message.asAny()) ! return jast.If(self.frame.getglobal("__debug__").nonzero(), jast.InvokeStatic("Py", "assert", args)) *************** *** 715,728 **** return [init, jast.While(test, suite)] ! def funcdef(self, name, args, body, doc=None): ! func = self.factory.makeFunction(name, args, body, doc) return self.set_name(name, func) ! def lambdef(self, args, body): ! func = self.factory.makeFunction("<lambda>", args, body) return func ! def classdef(self, name, bases, body, doc=None): ! c = self.factory.makeClass(name, bases, body, doc) self.module.classes[name] = c return self.set_name(name, c) --- 718,734 ---- return [init, jast.While(test, suite)] ! def funcdef(self, name, scope, body, doc=None): ! self.frame.setupClosure(scope) ! func = self.factory.makeFunction(name, self, scope, body, doc) return self.set_name(name, func) ! def lambdef(self, scope, body): ! self.frame.setupClosure(scope) ! func = self.factory.makeFunction("<lambda>", self, scope, body) return func ! def classdef(self, name, bases, scope, body, doc=None): ! self.frame.setupClosure(scope) ! c = self.factory.makeClass(name, bases, self, scope, body, doc) self.module.classes[name] = c return self.set_name(name, c) Index: compile.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/compile.py,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -r2.17 -r2.18 *** compile.py 2001/03/22 20:07:08 2.17 --- compile.py 2001/05/27 18:50:56 2.18 *************** *** 136,143 **** methods = [] for name, func in frame.names.items(): ! v = func.value.value args = None ! if hasattr(v, 'args'): ! args = v.args sig = None if hasattr(v, 'doc'): --- 136,143 ---- methods = [] for name, func in frame.names.items(): ! v = func.value args = None ! if hasattr(v, 'frame'): ! args = v.frame.scope.ac sig = None if hasattr(v, 'doc'): *************** *** 221,231 **** name = self.javapackage+'.'+name ! data = "__file__=%s\n" % repr(filename) + data + '\n\n' ! mod = PythonModule(name, filename, frozen=self.deep) fact = ObjectFactory() pi = SimpleCompiler(mod, fact, options=self.options) fact.parent = pi ! code = jast.Block(pi.execstring(data)) mod.addMain(code, pi) self.addDependencies(mod) --- 221,237 ---- name = self.javapackage+'.'+name ! data = data + '\n\n' ! mod = PythonModule(name, filename, frozen=self.deep) fact = ObjectFactory() pi = SimpleCompiler(mod, fact, options=self.options) fact.parent = pi ! code = pi.execstring(data) ! # __file__ ! code.insert(0,jast.Invoke(jast.Identifier('frame'),"setglobal", ! [jast.StringConstant('__file__'), ! mod.getStringConstant(filename)])) ! code.insert(1,jast.BlankLine()) ! code = jast.Block(code) mod.addMain(code, pi) self.addDependencies(mod) |
From: Samuele P. <ped...@us...> - 2001-05-27 18:49:18
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv24200/util Modified Files: InteractiveInterpreter.java PythonInterpreter.java Log Message: ** nested scopes (2) ** completes nested scopes support in interpreter: now nested scopes semantic settings are inherited trough exec, execfile, etc ... plus: assert now correctly get __debug__ as a global Index: InteractiveInterpreter.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/InteractiveInterpreter.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** InteractiveInterpreter.java 2000/12/04 21:18:59 2.3 --- InteractiveInterpreter.java 2001/05/27 18:49:15 2.4 *************** *** 8,14 **** --- 8,16 ---- public InteractiveInterpreter() { super(); + cflags = new CompilerFlags(); } public InteractiveInterpreter(PyObject locals) { super(locals); + cflags = new CompilerFlags(); } *************** *** 46,51 **** PyObject code; try { ! code = org.python.modules.codeop.compile_command( ! source, filename, symbol); } catch (PyException exc) { if (Py.matchException(exc, Py.SyntaxError)) { --- 48,53 ---- PyObject code; try { ! code = org.python.modules.codeop.compile_command_flags( ! source, filename, symbol,cflags); } catch (PyException exc) { if (Py.matchException(exc, Py.SyntaxError)) { Index: PythonInterpreter.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/PythonInterpreter.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** PythonInterpreter.java 2001/01/15 18:27:38 2.6 --- PythonInterpreter.java 2001/05/27 18:49:15 2.7 *************** *** 17,20 **** --- 17,22 ---- PyObject locals; + protected CompilerFlags cflags = null; + /** * Initialize the jython runtime. This method should only be *************** *** 133,137 **** public void exec(String s) { setState(); ! Py.exec(new PyString(s), locals, locals); } --- 135,139 ---- public void exec(String s) { setState(); ! Py.exec(Py.compile_flags(s, "<string>", "exec",cflags), locals, locals); } *************** *** 153,157 **** public void execfile(String s) { setState(); ! __builtin__.execfile(s, locals); } --- 155,159 ---- public void execfile(String s) { setState(); ! __builtin__.execfile_flags(s, locals, locals, cflags); } *************** *** 162,166 **** public void execfile(java.io.InputStream s, String name) { setState(); ! Py.runCode(Py.compile(s, name, "exec"), locals, locals); } --- 164,168 ---- public void execfile(java.io.InputStream s, String name) { setState(); ! Py.runCode(Py.compile_flags(s, name, "exec",cflags), locals, locals); } |
From: Samuele P. <ped...@us...> - 2001-05-27 18:49:18
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv24200/core Modified Files: Py.java PyFrame.java PyTableCode.java __builtin__.java imp.java Added Files: CompilerFlags.java Log Message: ** nested scopes (2) ** completes nested scopes support in interpreter: now nested scopes semantic settings are inherited trough exec, execfile, etc ... plus: assert now correctly get __debug__ as a global --- NEW FILE --- package org.python.core; public class CompilerFlags extends Object { public CompilerFlags() {} public CompilerFlags(int co_flags) { if ((co_flags&org.python.core.PyTableCode.CO_NESTED) != 0) nested_scopes = true; } public boolean nested_scopes; } Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -r2.43 -r2.44 *** Py.java 2001/05/15 18:53:35 2.43 --- Py.java 2001/05/27 18:49:15 2.44 *************** *** 433,437 **** } ! // nested scopes: String[] cellvars,String[] freevars,int xxx_npurecell & int moreflags public static PyCode newCode(int argcount, String varnames[], --- 433,437 ---- } ! // nested scopes: String[] cellvars,String[] freevars,int npurecell & int moreflags public static PyCode newCode(int argcount, String varnames[], *************** *** 439,447 **** boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell,int moreflags) { return new PyTableCode(argcount, varnames, filename, name, 0, args, keywords, funcs, ! func_id, cellvars, freevars, xxx_npurecell,moreflags); } --- 439,447 ---- boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int npurecell,int moreflags) { return new PyTableCode(argcount, varnames, filename, name, 0, args, keywords, funcs, ! func_id, cellvars, freevars, npurecell,moreflags); } *************** *** 451,460 **** boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell,int moreflags) { return new PyTableCode(argcount, varnames, filename, name, firstlineno, args, keywords, ! funcs, func_id, cellvars, freevars, xxx_npurecell,moreflags); } --- 451,460 ---- boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int npurecell,int moreflags) { return new PyTableCode(argcount, varnames, filename, name, firstlineno, args, keywords, ! funcs, func_id, cellvars, freevars, npurecell,moreflags); } *************** *** 1110,1114 **** throw Py.TypeError( "exec: argument 1 must be string, code or file object"); ! code = __builtin__.compile(contents, "<string>", "exec"); } Py.runCode(code, locals, globals); --- 1110,1114 ---- throw Py.TypeError( "exec: argument 1 must be string, code or file object"); ! code = Py.compile_flags(contents, "<string>", "exec",Py.getCompilerFlags()); } Py.runCode(code, locals, globals); *************** *** 1442,1445 **** --- 1442,1457 ---- } + + public static CompilerFlags getCompilerFlags() { + CompilerFlags cflags = null; + PyFrame frame = Py.getFrame(); + if (frame!=null && frame.f_code != null) { + cflags = new CompilerFlags(frame.f_code.co_flags); + } + return cflags; + } + + // w/o compiler-flags + public static PyCode compile(SimpleNode node, String filename) { return compile(node, getName(), filename); *************** *** 1457,1465 **** boolean printResults) { try { ByteArrayOutputStream ostream = new ByteArrayOutputStream(); org.python.compiler.Module.compile(node, ostream, name, filename, linenumbers, printResults, ! false); saveClassFile(name, ostream); --- 1469,1493 ---- boolean printResults) { + return compile_flags(node,name,filename,linenumbers,printResults,null); + } + + public static PyCode compile(InputStream istream, String filename, + String type) + { + return compile_flags(istream,filename,type,null); + } + + // with compiler-flags + + public static PyCode compile_flags(SimpleNode node, String name, + String filename, + boolean linenumbers, + boolean printResults,CompilerFlags cflags) + { try { ByteArrayOutputStream ostream = new ByteArrayOutputStream(); org.python.compiler.Module.compile(node, ostream, name, filename, linenumbers, printResults, ! false,cflags); saveClassFile(name, ostream); *************** *** 1471,1476 **** } ! public static PyCode compile(InputStream istream, String filename, ! String type) { SimpleNode node = parser.parse(istream, type, filename); --- 1499,1504 ---- } ! public static PyCode compile_flags(InputStream istream, String filename, ! String type,CompilerFlags cflags) { SimpleNode node = parser.parse(istream, type, filename); *************** *** 1478,1484 **** if (type.equals("single")) printResults = true; ! return Py.compile(node, getName(), filename, true, printResults); } ! public static PyObject[] unpackSequence(PyObject o, int length) { if (o instanceof PyTuple) { --- 1506,1517 ---- if (type.equals("single")) printResults = true; ! return Py.compile_flags(node, getName(), filename, true, printResults,cflags); } ! ! public static PyCode compile_flags(String data, String filename, String type,CompilerFlags cflags) { ! return Py.compile_flags(new java.io.StringBufferInputStream(data+"\n\n"), ! filename, type,cflags); ! } ! public static PyObject[] unpackSequence(PyObject o, int length) { if (o instanceof PyTuple) { Index: PyFrame.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFrame.java,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -r2.9 -r2.10 *** PyFrame.java 2001/05/22 12:38:03 2.9 --- PyFrame.java 2001/05/27 18:49:15 2.10 *************** *** 41,45 **** if (locals == null && code != null) { if ((code.co_flags&PyTableCode.CO_OPTIMIZED)!=0 || code.nargs > 0) { // ! f_fastlocals needed for arg passing too ! if (code.co_nlocals>0) f_fastlocals = new PyObject[code.co_nlocals-code.xxx_npurecell]; // internal: may change } else f_locals = new PyStringMap(); } --- 41,45 ---- if (locals == null && code != null) { if ((code.co_flags&PyTableCode.CO_OPTIMIZED)!=0 || code.nargs > 0) { // ! f_fastlocals needed for arg passing too ! if (code.co_nlocals>0) f_fastlocals = new PyObject[code.co_nlocals-code.jy_npurecell]; // internal: may change } else f_locals = new PyStringMap(); } Index: PyTableCode.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyTableCode.java,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** PyTableCode.java 2001/05/15 18:53:35 2.13 --- PyTableCode.java 2001/05/27 18:49:15 2.14 *************** *** 14,18 **** public String co_varnames[]; public String co_cellvars[]; ! public int xxx_npurecell; // internal: may change public String co_freevars[]; public String co_filename; --- 14,18 ---- public String co_varnames[]; public String co_cellvars[]; ! public int jy_npurecell; // internal: jython specific public String co_freevars[]; public String co_filename; *************** *** 44,48 **** boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell,int moreflags) // may change { co_argcount = nargs = argcount; --- 44,48 ---- boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int npurecell,int moreflags) // may change { co_argcount = nargs = argcount; *************** *** 53,57 **** co_cellvars = cellvars; co_freevars = freevars; ! this.xxx_npurecell = xxx_npurecell; this.args = args; co_name = name; --- 53,57 ---- co_cellvars = cellvars; co_freevars = freevars; ! this.jy_npurecell = npurecell; this.args = args; co_name = name; Index: __builtin__.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/__builtin__.java,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -r2.32 -r2.33 *** __builtin__.java 2001/04/25 19:04:32 2.32 --- __builtin__.java 2001/05/27 18:49:15 2.33 *************** *** 131,134 **** --- 131,136 ---- dict.__setitem__("id", new BuiltinFunctions("id", 11, 1)); dict.__setitem__("__import__", new ImportFunction()); + + dict.__delitem__("execfile_flags"); // -execfile_flags } *************** *** 209,215 **** } ! public static PyCode compile(String data, String filename, String type) { ! return Py.compile(new java.io.StringBufferInputStream(data+"\n\n"), ! filename, type); } --- 211,216 ---- } ! public static PyCode compile(String data, String filename, String type) { ! return Py.compile_flags(data,filename,type,Py.getCompilerFlags()); } *************** *** 259,264 **** else { if (o instanceof PyString) ! code = __builtin__.compile(((PyString)o).toString(), ! "<string>", "eval"); else throw Py.TypeError( --- 260,265 ---- else { if (o instanceof PyString) ! code = Py.compile_flags(((PyString)o).toString(), ! "<string>", "eval",null); // eval does not inherit co_nested else throw Py.TypeError( *************** *** 279,282 **** --- 280,290 ---- PyObject locals) { + execfile_flags(name,globals,locals,Py.getCompilerFlags()); + } + + + public static void execfile_flags(String name, PyObject globals, + PyObject locals,CompilerFlags cflags) + { java.io.FileInputStream file; try { *************** *** 288,292 **** try { ! code = Py.compile(file, name, "exec"); } finally { try { --- 296,300 ---- try { ! code = Py.compile_flags(file, name, "exec",cflags); } finally { try { *************** *** 302,305 **** --- 310,314 ---- execfile(name, globals, globals); } + public static void execfile(String name) { execfile(name, null, null); Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -r2.41 -r2.42 *** imp.java 2001/03/14 13:47:53 2.41 --- imp.java 2001/05/27 18:49:15 2.42 *************** *** 126,130 **** } org.python.compiler.Module.compile(node, ofp, name+"$py", ! filename, true, false, true); if (outFilename != null) { --- 126,130 ---- } org.python.compiler.Module.compile(node, ofp, name+"$py", ! filename, true, false, true,null); if (outFilename != null) { |
From: Samuele P. <ped...@us...> - 2001-05-27 18:49:18
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv24200/modules Modified Files: codeop.java Log Message: ** nested scopes (2) ** completes nested scopes support in interpreter: now nested scopes semantic settings are inherited trough exec, execfile, etc ... plus: assert now correctly get __debug__ as a global Index: codeop.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/codeop.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** codeop.java 2001/03/13 20:27:18 2.3 --- codeop.java 2001/05/27 18:49:15 2.4 *************** *** 4,12 **** import org.python.core.*; ! public class codeop { public static PyString __doc__ = new PyString( "Utility to compile possibly incomplete Python source code.\n" ); public static PyList __all__ = new PyList(new PyString[] { new PyString("compile_command") --- 4,18 ---- import org.python.core.*; ! public class codeop implements ClassDictInit { public static PyString __doc__ = new PyString( "Utility to compile possibly incomplete Python source code.\n" ); + public static void classDictInit(PyObject dict) + { + dict.__delitem__("compile_command_flags"); + dict.__delitem__("classInitDict"); + } + public static PyList __all__ = new PyList(new PyString[] { new PyString("compile_command") *************** *** 24,27 **** --- 30,38 ---- String kind) { + return compile_command_flags(string,filename,kind,null); + } + + public static PyObject compile_command_flags(String string,String filename,String kind,CompilerFlags cflags) + { org.python.parser.SimpleNode node = parser.partialParse(string+"\n", kind, filename); *************** *** 29,33 **** if (node == null) return Py.None; ! return Py.compile(node, Py.getName(), filename, true, true); } } --- 40,45 ---- if (node == null) return Py.None; ! return Py.compile_flags(node, Py.getName(), filename, true, true,cflags); } + } |
From: Samuele P. <ped...@us...> - 2001-05-27 18:49:18
|
Update of /cvsroot/jython/jython/org/python/compiler In directory usw-pr-cvs1:/tmp/cvs-serv24200/compiler Modified Files: CodeCompiler.java Future.java Module.java ScopeInfo.java ScopesCompiler.java Removed Files: CompilerFlags.java Log Message: ** nested scopes (2) ** completes nested scopes support in interpreter: now nested scopes semantic settings are inherited trough exec, execfile, etc ... plus: assert now correctly get __debug__ as a global Index: CodeCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/CodeCompiler.java,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -r2.14 -r2.15 *** CodeCompiler.java 2001/05/15 18:53:34 2.14 --- CodeCompiler.java 2001/05/27 18:49:15 2.15 *************** *** 7,10 **** --- 7,11 ---- import org.python.core.PyObject; import org.python.core.PyException; + import org.python.core.CompilerFlags; import java.io.IOException; import java.util.Stack; *************** *** 186,190 **** public void parse(SimpleNode node, Code code, boolean fast_locals, String className, ! boolean classBody, ScopeInfo scope) throws Exception { --- 187,191 ---- public void parse(SimpleNode node, Code code, boolean fast_locals, String className, ! boolean classBody, ScopeInfo scope,CompilerFlags cflags) throws Exception { *************** *** 195,199 **** if (scope == null) { futures = new Future(); ! futures.preprocessFutures(node,null); new ScopesCompiler(this).parse(node); scope = node.scope; --- 196,200 ---- if (scope == null) { futures = new Future(); ! futures.preprocessFutures(node,cflags); new ScopesCompiler(this).parse(node); scope = node.scope; *************** *** 782,794 **** public int assert1, assert2; ! public Object assert_stmt(SimpleNode node) throws Exception { // ?? pending __debug__ should be treated as temp global setline(node); Label end_of_assert = code.getLabel(); /* First do an if __debug__: */ ! SimpleNode debugName = new SimpleNode(PythonGrammarTreeConstants.JJTNAME); ! debugName.setInfo("__debug__"); ! debugName.visit(this); ! if (mrefs.nonzero == 0) { mrefs.nonzero = code.pool.Methodref("org/python/core/PyObject", --- 783,794 ---- public int assert1, assert2; ! public Object assert_stmt(SimpleNode node) throws Exception { setline(node); Label end_of_assert = code.getLabel(); /* First do an if __debug__: */ ! loadFrame(); ! emitGetGlobal("__debug__"); ! if (mrefs.nonzero == 0) { mrefs.nonzero = code.pool.Methodref("org/python/core/PyObject", *************** *** 2253,2256 **** --- 2253,2266 ---- int getderef,setderef; + void emitGetGlobal(String name) throws Exception { + code.ldc(name); + if (mrefs.getglobal == 0) { + mrefs.getglobal = code.pool.Methodref( + "org/python/core/PyFrame", "getglobal", + "(Ljava/lang/String;)Lorg/python/core/PyObject;"); + } + code.invokevirtual(mrefs.getglobal); + } + public Object Name(SimpleNode node) throws Exception { String name; *************** *** 2275,2285 **** if ((flags&ScopeInfo.GLOBAL) !=0 || optimizeGlobals&&(flags&(ScopeInfo.BOUND|ScopeInfo.CELL|ScopeInfo.FREE))==0) { ! code.ldc(name); ! if (mrefs.getglobal == 0) { ! mrefs.getglobal = code.pool.Methodref( ! "org/python/core/PyFrame", "getglobal", ! "(Ljava/lang/String;)Lorg/python/core/PyObject;"); ! } ! code.invokevirtual(mrefs.getglobal); return null; } --- 2285,2289 ---- if ((flags&ScopeInfo.GLOBAL) !=0 || optimizeGlobals&&(flags&(ScopeInfo.BOUND|ScopeInfo.CELL|ScopeInfo.FREE))==0) { ! emitGetGlobal(name); return null; } Index: Future.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/Future.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** Future.java 2001/03/10 02:13:48 2.2 --- Future.java 2001/05/27 18:49:15 2.3 *************** *** 41,45 **** } ! public void preprocessFutures(SimpleNode node,CompilerFlags cflags) throws Exception { if (cflags != null) { nested_scopes = cflags.nested_scopes; --- 41,45 ---- } ! public void preprocessFutures(SimpleNode node,org.python.core.CompilerFlags cflags) throws Exception { if (cflags != null) { nested_scopes = cflags.nested_scopes; Index: Module.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/Module.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** Module.java 2001/05/15 18:53:34 2.6 --- Module.java 2001/05/27 18:49:15 2.7 *************** *** 197,201 **** public String[] cellvars; public String[] freevars; ! public int xxx_npurecell; public int moreflags; --- 197,201 ---- public String[] cellvars; public String[] freevars; ! public int jy_npurecell; public int moreflags; *************** *** 237,241 **** if (freevars != null) CodeCompiler.makeStrings(c, freevars, freevars.length); else c.aconst_null(); ! c.iconst(xxx_npurecell); c.iconst(moreflags); --- 237,241 ---- if (freevars != null) CodeCompiler.makeStrings(c, freevars, freevars.length); else c.aconst_null(); ! c.iconst(jy_npurecell); c.iconst(moreflags); *************** *** 360,368 **** private int to_cell; public PyCodeConstant PyCode(SimpleNode tree, String name, boolean fast_locals, String className, boolean classBody, boolean printResults, ! int firstlineno, ScopeInfo scope) throws Exception { --- 360,378 ---- private int to_cell; + + public PyCodeConstant PyCode(SimpleNode tree, String name, + boolean fast_locals, String className, + boolean classBody, boolean printResults, + int firstlineno, ScopeInfo scope) + throws Exception + { + return PyCode(tree,name,fast_locals,className,classBody,printResults,firstlineno,scope,null); + } + public PyCodeConstant PyCode(SimpleNode tree, String name, boolean fast_locals, String className, boolean classBody, boolean printResults, ! int firstlineno, ScopeInfo scope,org.python.core.CompilerFlags cflags) throws Exception { *************** *** 402,406 **** if (scope != null) { ! int nparamcell = scope.xxx_paramcells.size(); if (nparamcell > 0) { if (to_cell == 0) { --- 412,416 ---- if (scope != null) { ! int nparamcell = scope.jy_paramcells.size(); if (nparamcell > 0) { if (to_cell == 0) { *************** *** 408,412 **** } Hashtable tbl = scope.tbl; ! Vector paramcells = scope.xxx_paramcells; for (int i = 0; i < nparamcell; i++) { c.aload(1); --- 418,422 ---- } Hashtable tbl = scope.tbl; ! Vector paramcells = scope.jy_paramcells; for (int i = 0; i < nparamcell; i++) { c.aload(1); *************** *** 419,423 **** } ! compiler.parse(tree, c, fast_locals, className, classBody, scope); // !classdef only --- 429,433 ---- } ! compiler.parse(tree, c, fast_locals, className, classBody, scope,cflags); // !classdef only *************** *** 427,436 **** code.cellvars = toNameAr(scope.cellvars,true); code.freevars = toNameAr(scope.freevars,true); ! code.xxx_npurecell = scope.xxx_npurecell; ! if (compiler.optimizeGlobals) { ! code.moreflags |= org.python.core.PyTableCode.CO_OPTIMIZED; ! } } ! code.module = this; code.name = code.fname; --- 437,450 ---- code.cellvars = toNameAr(scope.cellvars,true); code.freevars = toNameAr(scope.freevars,true); ! code.jy_npurecell = scope.jy_npurecell; } ! ! if (compiler.optimizeGlobals) { ! code.moreflags |= org.python.core.PyTableCode.CO_OPTIMIZED; ! } ! if (compiler.my_scope.nested_scopes) { ! code.moreflags |= org.python.core.PyTableCode.CO_NESTED; ! } ! code.module = this; code.name = code.fname; *************** *** 554,558 **** String name, String filename, boolean linenumbers, boolean printResults, ! boolean setFile) throws Exception { --- 568,572 ---- String name, String filename, boolean linenumbers, boolean printResults, ! boolean setFile,org.python.core.CompilerFlags cflags) throws Exception { *************** *** 562,566 **** //Add __file__ for filename (if it exists?) ! Constant main = module.PyCode(node, "?",false, null, false, printResults, 0,null); module.mainCode = main; module.write(ostream); --- 576,580 ---- //Add __file__ for filename (if it exists?) ! Constant main = module.PyCode(node, "?",false, null, false, printResults, 0,null,cflags); module.mainCode = main; module.write(ostream); Index: ScopeInfo.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/ScopeInfo.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** ScopeInfo.java 2001/05/15 18:53:34 2.3 --- ScopeInfo.java 2001/05/27 18:49:15 2.4 *************** *** 104,110 **** public Vector cellvars = new Vector(); ! public Vector xxx_paramcells = new Vector(); ! public int xxx_npurecell; // ?? xxx public int cell; --- 104,110 ---- public Vector cellvars = new Vector(); ! public Vector jy_paramcells = new Vector(); ! public int jy_npurecell; public int cell; *************** *** 131,135 **** if (nested_scopes) { info.flags |= CELL; ! if ((info.flags&PARAM) != 0) xxx_paramcells.addElement(name); cellvars.addElement(name); info.env_index = cell++; --- 131,135 ---- if (nested_scopes) { info.flags |= CELL; ! if ((info.flags&PARAM) != 0) jy_paramcells.addElement(name); cellvars.addElement(name); info.env_index = cell++; *************** *** 163,167 **** } } ! if ((xxx_npurecell = purecells.size()) > 0) { int sz = purecells.size(); for (int i = 0; i < sz; i++) { --- 163,167 ---- } } ! if ((jy_npurecell = purecells.size()) > 0) { int sz = purecells.size(); for (int i = 0; i < sz; i++) { Index: ScopesCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/ScopesCompiler.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** ScopesCompiler.java 2001/05/15 18:53:34 2.3 --- ScopesCompiler.java 2001/05/27 18:49:15 2.4 *************** *** 9,15 **** private CompilationContext code_compiler; ! private boolean nested_scopes = false; ! private Stack scopes; private ScopeInfo cur = null; --- 9,15 ---- private CompilationContext code_compiler; ! private boolean nested_scopes = false; ! private Stack scopes; private ScopeInfo cur = null; *************** *** 24,35 **** private int func_level = 0; ! public ScopesCompiler(CompilationContext code_compiler) { // ?? polish this.code_compiler = code_compiler; scopes = new Stack(); mode = GET; ! String nested_scopes_opt = org.python.core.PySystemState.registry.getProperty("python.xfutures.nested_scopes"); ! if (nested_scopes_opt != null && nested_scopes_opt.equals("on")) nested_scopes = true; else nested_scopes = code_compiler.getFutures().areNestedScopesOn(); ! // System.err.println("nested-scopes: "+nested_scopes); } --- 24,35 ---- private int func_level = 0; ! public ScopesCompiler(CompilationContext code_compiler) { this.code_compiler = code_compiler; scopes = new Stack(); mode = GET; ! /*String nested_scopes_opt = org.python.core.PySystemState.registry.getProperty("python.xfutures.nested_scopes"); ! if (nested_scopes_opt != null && nested_scopes_opt.equals("on")) nested_scopes = true; else*/ nested_scopes = code_compiler.getFutures().areNestedScopesOn(); ! // System.err.println("nested-scopes: "+nested_scopes); } *************** *** 272,276 **** public Object for_stmt(SimpleNode node) throws Exception { ! if (mode != GET) illassign(node); set(node.getChild(0)); node.getChild(1).visit(this); --- 272,276 ---- public Object for_stmt(SimpleNode node) throws Exception { ! if (mode != GET) illassign(node); set(node.getChild(0)); node.getChild(1).visit(this); *************** *** 581,585 **** public Object Name(SimpleNode node) throws Exception { String name = (String)node.getInfo(); ! if ( mode != GET) cur.addBound(name); else cur.addUsed(name); return null; --- 581,588 ---- public Object Name(SimpleNode node) throws Exception { String name = (String)node.getInfo(); ! if ( mode != GET) { ! if (name.equals("__debug__")) code_compiler.error("can not assign to __debug__",false,node); ! cur.addBound(name); ! } else cur.addUsed(name); return null; --- CompilerFlags.java DELETED --- |
From: Samuele P. <ped...@us...> - 2001-05-22 12:38:06
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv30527 Modified Files: PyFrame.java Log Message: Partially reverted badly buggy change (that passed through the test suites). The point is that f_fastlocals is used and needed for arg passing too. Index: PyFrame.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFrame.java,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** PyFrame.java 2001/05/15 18:53:35 2.8 --- PyFrame.java 2001/05/22 12:38:03 2.9 *************** *** 40,44 **** // This needs work to be efficient with multiple interpreter states if (locals == null && code != null) { ! if ((code.co_flags&PyTableCode.CO_OPTIMIZED)!=0) { if (code.co_nlocals>0) f_fastlocals = new PyObject[code.co_nlocals-code.xxx_npurecell]; // internal: may change } else f_locals = new PyStringMap(); --- 40,44 ---- // This needs work to be efficient with multiple interpreter states if (locals == null && code != null) { ! if ((code.co_flags&PyTableCode.CO_OPTIMIZED)!=0 || code.nargs > 0) { // ! f_fastlocals needed for arg passing too if (code.co_nlocals>0) f_fastlocals = new PyObject[code.co_nlocals-code.xxx_npurecell]; // internal: may change } else f_locals = new PyStringMap(); *************** *** 121,128 **** if (o != null) f_locals.__setitem__(f_code.co_varnames[i], o); } ! /* ?? xxx_ ! // This should turn off fast_locals optimization after somebody ! // gets the locals dict ! f_fastlocals = null; */ } int j = 0; --- 121,125 ---- if (o != null) f_locals.__setitem__(f_code.co_varnames[i], o); } ! if ((f_code.co_flags&PyTableCode.CO_OPTIMIZED) == 0) f_fastlocals = null; } int j = 0; |
From: <bc...@wo...> - 2001-05-22 09:14:34
|
[Samuele] >Update of /cvsroot/jython/jython/org/python/core >In directory usw-pr-cvs1:/tmp/cvs-serv2169/core > >Modified Files: > Py.java PyFrame.java PyTableCode.java parser.java >Log Message: >- fixed bug #415963 UnboundLocalError not raised on delete . >- fixed bug related to free+bound vars in class scope . >- incresead CPython compatibility: > * code supports co_nlocals, co_flags have CO_OPTIMIZED set when > meaningful > * def f(): > locals()['a']=1 > print a > now raises a NameError (like in CPython) > * co_varnames == () and co_nlocals = 0 for classdef code >! Py.newCode and related funcs signatures have been changed >- PyFrame.getf_locals() now deals with cell and free vars > and handles the classdef case >- compiler tiny mods for use by jythonc nested scopes support The recent set of checkins causes a NPE like this: >>> from java.lang import Thread >>> >>> class TestThread(Thread): ... def run(self): ... for i in range(100): ... exec("x=2+2") ... >>> t = TestThread() >>> t.start() >>> java.lang.NullPointerException at java.lang.System.arraycopy(Native Method) at org.python.core.PyTableCode.call(PyTableCode.java:320) at org.python.core.PyTableCode.call(PyTableCode.java:297) at org.python.core.PyFunction.__call__(PyFunction.java:185) at org.python.core.PyMethod.__call__(PyMethod.java:96) at org.python.core.PyObject.__call__(PyObject.java:252) at org.python.core.PyObject._jcallexc(PyObject.java:1957) at org.python.core.PyObject._jcall(PyObject.java:1989) at org.python.proxies.__main__$TestThread$0.run(Unknown Source) This appears to fix it, but could you verify that is look OK. --- PyTableCode.java.org Tue May 22 07:28:42 2001 +++ PyTableCode.java Tue May 22 08:15:45 2001 @@ -316,7 +316,7 @@ plain_args = co_argcount; actual_args = my_frame.f_fastlocals; - if (plain_args > 0) + if (plain_args > 0 && actual_args != null) System.arraycopy(call_args, 0, actual_args, 0, plain_args); if (!((call_keywords == null || call_keywords.length == 0) && The changes also cause a NPE when running this jythonc'ed code: def makedict(list): return {} makedict([ "FAILURE", ]) java.lang.NullPointerException at org.python.core.PyTableCode.call(PyTableCode.java:261) at org.python.core.PyFunction.__call__(PyFunction.java:170) at x$_PyInner.main$2(x.java:45) at x$_PyInner.call_function(x.java:32) at org.python.core.PyTableCode.call(PyTableCode.java:207) at org.python.core.PyCode.call(PyCode.java:13) at org.python.core.imp.createFromCode(imp.java:165) at org.python.core.Py.runMain(Py.java:818) at x.main(x.java:59) Again it seems to be related to the CO_OPTIMIZED/f_fastlocals but I can't see an immediate fix for this problem. regards, finn |
From: Samuele P. <ped...@us...> - 2001-05-15 18:53:38
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv2169/core Modified Files: Py.java PyFrame.java PyTableCode.java parser.java Log Message: - fixed bug #415963 UnboundLocalError not raised on delete . - fixed bug related to free+bound vars in class scope . - incresead CPython compatibility: * code supports co_nlocals, co_flags have CO_OPTIMIZED set when meaningful * def f(): locals()['a']=1 print a now raises a NameError (like in CPython) * co_varnames == () and co_nlocals = 0 for classdef code ! Py.newCode and related funcs signatures have been changed - PyFrame.getf_locals() now deals with cell and free vars and handles the classdef case - compiler tiny mods for use by jythonc nested scopes support Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -r2.42 -r2.43 *** Py.java 2001/04/13 18:43:41 2.42 --- Py.java 2001/05/15 18:53:35 2.43 *************** *** 433,437 **** } ! // nested scopes: String[] cellvars,String[] freevars,int xxx_npurecell public static PyCode newCode(int argcount, String varnames[], --- 433,437 ---- } ! // nested scopes: String[] cellvars,String[] freevars,int xxx_npurecell & int moreflags public static PyCode newCode(int argcount, String varnames[], *************** *** 439,447 **** boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell) { return new PyTableCode(argcount, varnames, filename, name, 0, args, keywords, funcs, ! func_id, cellvars, freevars, xxx_npurecell); } --- 439,447 ---- boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell,int moreflags) { return new PyTableCode(argcount, varnames, filename, name, 0, args, keywords, funcs, ! func_id, cellvars, freevars, xxx_npurecell,moreflags); } *************** *** 451,460 **** boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell) { return new PyTableCode(argcount, varnames, filename, name, firstlineno, args, keywords, ! funcs, func_id, cellvars, freevars, xxx_npurecell); } --- 451,460 ---- boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell,int moreflags) { return new PyTableCode(argcount, varnames, filename, name, firstlineno, args, keywords, ! funcs, func_id, cellvars, freevars, xxx_npurecell,moreflags); } Index: PyFrame.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFrame.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** PyFrame.java 2001/03/08 23:43:51 2.7 --- PyFrame.java 2001/05/15 18:53:35 2.8 *************** *** 39,44 **** f_builtins = builtins; // This needs work to be efficient with multiple interpreter states ! if (locals == null && code != null && code.co_varnames.length > 0) { ! f_fastlocals = new PyObject[code.co_varnames.length-code.xxx_npurecell]; // internal: may change } if (code != null) { // reserve space for env --- 39,46 ---- f_builtins = builtins; // This needs work to be efficient with multiple interpreter states ! if (locals == null && code != null) { ! if ((code.co_flags&PyTableCode.CO_OPTIMIZED)!=0) { ! if (code.co_nlocals>0) f_fastlocals = new PyObject[code.co_nlocals-code.xxx_npurecell]; // internal: may change ! } else f_locals = new PyStringMap(); } if (code != null) { // reserve space for env *************** *** 112,124 **** if (f_locals == null) f_locals = new PyStringMap(); ! if (f_fastlocals != null && f_code != null) { ! for (int i=0; i<f_fastlocals.length; i++) { ! PyObject o = f_fastlocals[i]; ! if (o != null) ! f_locals.__setitem__(f_code.co_varnames[i], o); } ! // This should turn off fast_locals optimization after somebody ! // gets the locals dict ! f_fastlocals = null; } return f_locals; --- 114,138 ---- if (f_locals == null) f_locals = new PyStringMap(); ! if (f_code!=null && f_code.co_nlocals>0) { ! int i; ! if (f_fastlocals != null) { ! for (i=0; i<f_fastlocals.length; i++) { ! PyObject o = f_fastlocals[i]; ! if (o != null) f_locals.__setitem__(f_code.co_varnames[i], o); ! } ! /* ?? xxx_ ! // This should turn off fast_locals optimization after somebody ! // gets the locals dict ! f_fastlocals = null; */ } ! int j = 0; ! for (i=0; i<f_ncells; i++,j++) { ! PyObject v = f_env[j].ob_ref; ! if (v != null) f_locals.__setitem__(f_code.co_cellvars[i],v); ! } ! for (i=0; i<f_nfreevars; i++,j++) { ! PyObject v = f_env[j].ob_ref; ! if (v != null) f_locals.__setitem__(f_code.co_freevars[i],v); ! } } return f_locals; *************** *** 199,205 **** public void dellocal(int index) { ! if (f_fastlocals != null) ! f_fastlocals[index] = null; ! else dellocal(f_code.co_varnames[index]); } --- 213,222 ---- public void dellocal(int index) { ! if (f_fastlocals != null) { ! if (f_fastlocals[index] == null) { ! throw Py.UnboundLocalError("local: '"+f_code.co_varnames[index]+"'"); ! } ! f_fastlocals[index] = null; ! } else dellocal(f_code.co_varnames[index]); } *************** *** 208,212 **** if (f_locals == null) getf_locals(); ! f_locals.__delitem__(index); } --- 225,234 ---- if (f_locals == null) getf_locals(); ! try { ! f_locals.__delitem__(index); ! } catch(PyException e) { ! if (!Py.matchException(e,Py.KeyError)) throw e; ! throw Py.UnboundLocalError("local: '"+index+"'"); ! } } Index: PyTableCode.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyTableCode.java,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -r2.12 -r2.13 *** PyTableCode.java 2001/03/08 23:43:51 2.12 --- PyTableCode.java 2001/05/15 18:53:35 2.13 *************** *** 18,25 **** public String co_filename; public int co_flags; public boolean args, keywords; PyFunctionTable funcs; int func_id; ! public PyTableCode(int argcount, String varnames[], --- 18,32 ---- public String co_filename; public int co_flags; + public int co_nlocals; public boolean args, keywords; PyFunctionTable funcs; int func_id; ! ! final public static int CO_OPTIMIZED = 0x0001; ! //final public static int CO_NEWLOCALS = 0x0002 ! final public static int CO_VARARGS = 0x0004; ! final public static int CO_VARKEYWORDS = 0x0008; ! final public static int CO_NESTED = 0x0010; ! public PyTableCode(int argcount, String varnames[], *************** *** 29,33 **** PyFunctionTable funcs, int func_id) { ! this(argcount,varnames,filename,name,firstlineno,args,keywords,funcs,func_id,null,null,0); } --- 36,40 ---- PyFunctionTable funcs, int func_id) { ! this(argcount,varnames,filename,name,firstlineno,args,keywords,funcs,func_id,null,null,0,0); } *************** *** 37,44 **** boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell) // may change { co_argcount = nargs = argcount; co_varnames = varnames; co_filename = filename; co_firstlineno = firstlineno; --- 44,52 ---- boolean args, boolean keywords, PyFunctionTable funcs, int func_id, ! String[] cellvars,String[] freevars,int xxx_npurecell,int moreflags) // may change { co_argcount = nargs = argcount; co_varnames = varnames; + co_nlocals = varnames.length; co_filename = filename; co_firstlineno = firstlineno; *************** *** 50,60 **** if (args) { co_argcount -= 1; ! co_flags |= 0x04; } this.keywords = keywords; if (keywords) { co_argcount -= 1; ! co_flags |= 0x08; } this.funcs = funcs; this.func_id = func_id; --- 58,69 ---- if (args) { co_argcount -= 1; ! co_flags |= CO_VARARGS; } this.keywords = keywords; if (keywords) { co_argcount -= 1; ! co_flags |= CO_VARKEYWORDS; } + co_flags |= moreflags; this.funcs = funcs; this.func_id = func_id; *************** *** 64,69 **** "co_name", "co_argcount", "co_varnames", "co_filename", "co_firstlineno", ! "co_flags","co_cellvars","co_freevars" ! // not supported: co_nlocals, co_code, co_consts, co_names, // co_lnotab, co_stacksize }; --- 73,78 ---- "co_name", "co_argcount", "co_varnames", "co_filename", "co_firstlineno", ! "co_flags","co_cellvars","co_freevars","co_nlocals" ! // not supported: co_code, co_consts, co_names, // co_lnotab, co_stacksize }; Index: parser.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/parser.java,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** parser.java 2001/02/25 16:52:54 2.8 --- parser.java 2001/05/15 18:53:35 2.9 *************** *** 27,31 **** } ! static PyException fixParseError(BufferedReader reader, Throwable t, String filename) { --- 27,31 ---- } ! static public PyException fixParseError(BufferedReader reader, Throwable t, String filename) { |
From: Samuele P. <ped...@us...> - 2001-05-15 18:53:38
|
Update of /cvsroot/jython/jython/org/python/compiler In directory usw-pr-cvs1:/tmp/cvs-serv2169/compiler Modified Files: CodeCompiler.java Module.java ScopeInfo.java ScopesCompiler.java Added Files: CompilationContext.java Log Message: - fixed bug #415963 UnboundLocalError not raised on delete . - fixed bug related to free+bound vars in class scope . - incresead CPython compatibility: * code supports co_nlocals, co_flags have CO_OPTIMIZED set when meaningful * def f(): locals()['a']=1 print a now raises a NameError (like in CPython) * co_varnames == () and co_nlocals = 0 for classdef code ! Py.newCode and related funcs signatures have been changed - PyFrame.getf_locals() now deals with cell and free vars and handles the classdef case - compiler tiny mods for use by jythonc nested scopes support --- NEW FILE --- package org.python.compiler; import org.python.parser.SimpleNode; public interface CompilationContext { public Future getFutures(); public void error(String msg,boolean err,SimpleNode node) throws Exception; public String getFilename(); } Index: CodeCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/CodeCompiler.java,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** CodeCompiler.java 2001/03/10 02:13:48 2.13 --- CodeCompiler.java 2001/05/15 18:53:34 2.14 *************** *** 12,16 **** import java.util.Vector; ! public class CodeCompiler extends Visitor { public static final Object Exit=new Integer(1); --- 12,16 ---- import java.util.Vector; ! public class CodeCompiler extends Visitor implements CompilationContext { public static final Object Exit=new Integer(1); *************** *** 39,42 **** --- 39,46 ---- public ScopeInfo my_scope; + public Future getFutures() { return futures; } + public String getFilename() { return module.sfilename; } + + boolean optimizeGlobals = true; public Vector names; *************** *** 200,204 **** tbl = scope.tbl; ! optimizeGlobals = !scope.exec&&!scope.from_import_star; mode = GET; --- 204,208 ---- tbl = scope.tbl; ! optimizeGlobals = fast_locals&&!scope.exec&&!scope.from_import_star; mode = GET; *************** *** 2270,2274 **** if (!my_scope.nested_scopes) flags &= ~ScopeInfo.FREE; if ((flags&ScopeInfo.GLOBAL) !=0 || ! optimizeGlobals&&fast_locals&&(flags&(ScopeInfo.BOUND|ScopeInfo.CELL|ScopeInfo.FREE))==0) { code.ldc(name); if (mrefs.getglobal == 0) { --- 2274,2278 ---- if (!my_scope.nested_scopes) flags &= ~ScopeInfo.FREE; if ((flags&ScopeInfo.GLOBAL) !=0 || ! optimizeGlobals&&(flags&(ScopeInfo.BOUND|ScopeInfo.CELL|ScopeInfo.FREE))==0) { code.ldc(name); if (mrefs.getglobal == 0) { *************** *** 2302,2306 **** } } ! if ((flags&ScopeInfo.FREE) != 0) { code.iconst(syminf.env_index); if (mrefs.getderef == 0) { --- 2306,2310 ---- } } ! if ((flags&ScopeInfo.FREE) != 0 && (flags&ScopeInfo.BOUND) == 0) { code.iconst(syminf.env_index); if (mrefs.getderef == 0) { *************** *** 2419,2421 **** --- 2423,2426 ---- return null; } + } Index: Module.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/Module.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -r2.5 -r2.6 *** Module.java 2001/03/13 20:19:10 2.5 --- Module.java 2001/05/15 18:53:34 2.6 *************** *** 198,201 **** --- 198,203 ---- public String[] freevars; public int xxx_npurecell; + + public int moreflags; public PyCodeConstant() { ; *************** *** 211,215 **** //Make all names ! CodeCompiler.makeStrings(c, names, names.length); c.ldc(((PyStringConstant)module.filename).value); --- 213,221 ---- //Make all names ! if (names != null) { ! CodeCompiler.makeStrings(c, names, names.length); ! } else { // classdef ! CodeCompiler.makeStrings(c, null, 0); ! } c.ldc(((PyStringConstant)module.filename).value); *************** *** 233,240 **** c.iconst(xxx_npurecell); int mref_newCode = c.pool.Methodref( "org/python/core/Py", "newCode", ! "(I[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZLorg/python/core/PyFunctionTable;I[Ljava/lang/String;[Ljava/lang/String;I)Lorg/python/core/PyCode;"); c.invokestatic(mref_newCode); --- 239,248 ---- c.iconst(xxx_npurecell); + c.iconst(moreflags); + int mref_newCode = c.pool.Methodref( "org/python/core/Py", "newCode", ! "(I[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZLorg/python/core/PyFunctionTable;I[Ljava/lang/String;[Ljava/lang/String;II)Lorg/python/core/PyCode;"); c.invokestatic(mref_newCode); *************** *** 413,417 **** compiler.parse(tree, c, fast_locals, className, classBody, scope); ! code.names = toNameAr(compiler.names,false); if (scope != null) { --- 421,426 ---- compiler.parse(tree, c, fast_locals, className, classBody, scope); ! // !classdef only ! if (!classBody) code.names = toNameAr(compiler.names,false); if (scope != null) { *************** *** 419,422 **** --- 428,434 ---- code.freevars = toNameAr(scope.freevars,true); code.xxx_npurecell = scope.xxx_npurecell; + if (compiler.optimizeGlobals) { + code.moreflags |= org.python.core.PyTableCode.CO_OPTIMIZED; + } } Index: ScopeInfo.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/ScopeInfo.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** ScopeInfo.java 2001/03/11 16:29:31 2.2 --- ScopeInfo.java 2001/05/15 18:53:34 2.3 *************** *** 110,114 **** public int cell; ! public void cook(ScopeInfo up,CodeCompiler ctxt) throws Exception { if (up == null) return; // top level => nop --- 110,114 ---- public int cell; ! public void cook(ScopeInfo up,CompilationContext ctxt) throws Exception { if (up == null) return; // top level => nop *************** *** 176,180 **** } ! private void dynastuff_trouble(boolean inner_free,CodeCompiler ctxt) throws Exception { String illegal; if (unqual_exec && from_import_star) --- 176,180 ---- } ! private void dynastuff_trouble(boolean inner_free,CompilationContext ctxt) throws Exception { String illegal; if (unqual_exec && from_import_star) Index: ScopesCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/ScopesCompiler.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** ScopesCompiler.java 2001/03/10 02:13:48 2.2 --- ScopesCompiler.java 2001/05/15 18:53:34 2.3 *************** *** 8,12 **** public class ScopesCompiler extends Visitor implements ScopeConstants { ! private CodeCompiler code_compiler; private boolean nested_scopes = false; --- 8,12 ---- public class ScopesCompiler extends Visitor implements ScopeConstants { ! private CompilationContext code_compiler; private boolean nested_scopes = false; *************** *** 24,28 **** private int func_level = 0; ! public ScopesCompiler(CodeCompiler code_compiler) { // ?? polish this.code_compiler = code_compiler; scopes = new Stack(); --- 24,28 ---- private int func_level = 0; ! public ScopesCompiler(CompilationContext code_compiler) { // ?? polish this.code_compiler = code_compiler; scopes = new Stack(); *************** *** 30,34 **** String nested_scopes_opt = org.python.core.PySystemState.registry.getProperty("python.xfutures.nested_scopes"); if (nested_scopes_opt != null && nested_scopes_opt.equals("on")) nested_scopes = true; else ! nested_scopes = code_compiler.futures.areNestedScopesOn(); // System.err.println("nested-scopes: "+nested_scopes); } --- 30,34 ---- String nested_scopes_opt = org.python.core.PySystemState.registry.getProperty("python.xfutures.nested_scopes"); if (nested_scopes_opt != null && nested_scopes_opt.equals("on")) nested_scopes = true; else ! nested_scopes = code_compiler.getFutures().areNestedScopesOn(); // System.err.println("nested-scopes: "+nested_scopes); } *************** *** 72,76 **** --- 72,80 ---- public void parse(SimpleNode node) throws Exception { + try { node.visit(this); + } catch(Throwable t) { + throw org.python.core.parser.fixParseError(null,t,code_compiler.getFilename()); + } } |
From: Finn B. <bc...@us...> - 2001-05-09 18:36:53
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv23191 Modified Files: index.ht Log Message: Updated link to TIPatterns. Index: index.ht =================================================================== RCS file: /cvsroot/jython/htdocs/index.ht,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** index.ht 2001/04/27 19:21:18 1.18 --- index.ht 2001/05/09 18:36:50 1.19 *************** *** 64,68 **** <p><dt><b>8-dec-2000</b> <dd>Bruce Eckel has release a new revision of his ! <a href="http://www.mindview.net/TIPatterns/index.html"> Thinking in Patterns with Java</a> book and chapter 9 has been updated to cover Jython. --- 64,68 ---- <p><dt><b>8-dec-2000</b> <dd>Bruce Eckel has release a new revision of his ! <a href="http://www.mindview.net/Books/TIPatterns/"> Thinking in Patterns with Java</a> book and chapter 9 has been updated to cover Jython. |
From: Finn B. <bc...@us...> - 2001-05-07 19:29:59
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv23495 Modified Files: users.ht Log Message: Added another user. Index: users.ht =================================================================== RCS file: /cvsroot/jython/htdocs/users.ht,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** users.ht 2001/02/25 17:09:32 1.4 --- users.ht 2001/05/07 19:29:53 1.5 *************** *** 15,17 **** --- 15,22 ---- Wizard player and develop new game areas and objects using Jython. + <p><dt><b><a href="http://www.free-schooling.org">FreePlay</a></b> + <dd>The Freeplay project is developing a free course authoring tool which + can be used to create lessons which are more like adventure games than + school lessons. Jython is used as the scripting language. + </dl> |
From: Finn B. <bc...@us...> - 2001-05-07 19:21:24
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv21402 Modified Files: proxies.py Log Message: Revert the fix for #222819. Index: proxies.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/proxies.py,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** proxies.py 2001/03/22 20:07:08 2.10 --- proxies.py 2001/05/07 19:21:21 2.11 *************** *** 119,123 **** self.supername = supername self.methods = methods ! self.issuperproxy = issuperproxy self.packages = self.properties = jast.Null --- 119,123 ---- self.supername = supername self.methods = methods ! self.issuperproxy = 0 #issuperproxy self.packages = self.properties = jast.Null |
From: Finn B. <bc...@us...> - 2001-05-07 19:18:36
|
Update of /cvsroot/jython/jython/org/python/compiler In directory usw-pr-cvs1:/tmp/cvs-serv20429 Modified Files: JavaMaker.java Log Message: addSuperMethod(): Revert the fix for #222819. Index: JavaMaker.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/JavaMaker.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** JavaMaker.java 2001/03/22 20:05:52 2.10 --- JavaMaker.java 2001/05/07 19:18:33 2.11 *************** *** 126,130 **** } ! public void addSuperMethod(String methodName, String superName, String superclass, Class[] parameters, --- 126,130 ---- } ! /* public void addSuperMethod(String methodName, String superName, String superclass, Class[] parameters, *************** *** 136,139 **** --- 136,141 ---- } } + + */ public void addMain() throws Exception { |
From: Finn B. <bc...@us...> - 2001-05-07 19:15:58
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv19764 Modified Files: PyClass.java Log Message: init(): Make the process of updating based on the __supername__ dict a little more robust. Needed reverting the fix for bug #122819. Index: PyClass.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyClass.java,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -r2.24 -r2.25 *** PyClass.java 2001/04/25 18:39:24 2.24 --- PyClass.java 2001/05/07 19:15:56 2.25 *************** *** 135,140 **** PyObject sname; for (int i = 0; (sname = snames.__finditem__(i)) != null; i++) { ! if (__dict__.__finditem__(sname) == null) ! __dict__.__setitem__(sname, superDict.__getitem__(sname)); } } --- 135,143 ---- PyObject sname; for (int i = 0; (sname = snames.__finditem__(i)) != null; i++) { ! if (__dict__.__finditem__(sname) == null) { ! PyObject superFunc = superDict.__finditem__(sname); ! if (superFunc != null) ! __dict__.__setitem__(sname, superFunc); ! } } } |
From: Finn B. <bc...@us...> - 2001-04-27 19:31:56
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv10735 Modified Files: links.h Log Message: Removed link to PSA and added PSF. Index: links.h =================================================================== RCS file: /cvsroot/jython/htdocs/links.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** links.h 2001/03/14 15:44:36 1.7 --- links.h 2001/04/27 19:31:54 1.8 *************** *** 23,26 **** <h3>Exits</h3> <li><a href="http://www.python.org/">Python Language</a> ! <li><a href="http://www.python.org/psa">PSA</a> <li><a href="http://www.javasoft.com">Java Language</a> --- 23,26 ---- <h3>Exits</h3> <li><a href="http://www.python.org/">Python Language</a> ! <li><a href="http://www.python.org/psf">PSF</a> <li><a href="http://www.javasoft.com">Java Language</a> |
From: Finn B. <bc...@us...> - 2001-04-27 19:21:21
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv9007 Modified Files: index.ht Log Message: Added Ross Lonstein's article. Index: index.ht =================================================================== RCS file: /cvsroot/jython/htdocs/index.ht,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** index.ht 2001/03/14 15:43:42 1.17 --- index.ht 2001/04/27 19:21:18 1.18 *************** *** 47,50 **** --- 47,57 ---- <dl> + + <p><dt><b>8-apr-2001</b> + <dd>Ross Lonstein has written an + <a href="http://www.agoron.com/~lonstein/articles/jython-bsf.html">article</a> + on how Jython can be integrated with + <a href="http://oss.software.ibm.com/developerworks/projects/bsf">BSF</a>. + <p><dt><b>12-mar-2001</b> <dd>Weiqi Gao <a href="http://www.ociweb.com/jnb/archive/jnbMar2001.html">shows</a> |
From: Finn B. <bc...@us...> - 2001-04-25 19:04:35
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv32407 Modified Files: __builtin__.java Log Message: Improve CPython compatibiliy by raising an exception when the coerce() building fails to perform the coercion. Index: __builtin__.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/__builtin__.java,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -r2.31 -r2.32 *** __builtin__.java 2001/03/04 18:12:33 2.31 --- __builtin__.java 2001/04/25 19:04:32 2.32 *************** *** 206,210 **** } } ! return new PyTuple(new PyObject[] {o1, o2}); } --- 206,210 ---- } } ! throw Py.TypeError("number coercion failed"); } |
From: Finn B. <bc...@us...> - 2001-04-25 18:56:21
|
Update of /cvsroot/jython/jython/org/python/parser In directory usw-pr-cvs1:/tmp/cvs-serv30119 Modified Files: PythonGrammar.java PythonGrammarConstants.java PythonGrammarTokenManager.java Log Message: Committing generated files for bug #410794. Index: PythonGrammar.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/PythonGrammar.java,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** PythonGrammar.java 2000/12/12 21:23:17 2.11 --- PythonGrammar.java 2001/04/25 18:56:18 2.12 *************** *** 55,59 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: simple_stmt(); break; --- 55,59 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: simple_stmt(); break; *************** *** 147,151 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: ; break; --- 147,151 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: ; break; *************** *** 194,198 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: stmt(); break; --- 194,198 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: stmt(); break; *************** *** 644,648 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: simple_stmt(); break; --- 644,648 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: simple_stmt(); break; *************** *** 707,711 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: expr_stmt(); break; --- 707,711 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: expr_stmt(); break; *************** *** 1349,1353 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: SmartTestList(); break; --- 1349,1353 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: SmartTestList(); break; *************** *** 1406,1410 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: test(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { --- 1406,1410 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: test(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { *************** *** 2134,2138 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: test(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { --- 2134,2138 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: test(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { *************** *** 2211,2215 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: simple_stmt(); break; --- 2211,2215 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: simple_stmt(); break; *************** *** 2257,2261 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: ; break; --- 2257,2261 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: ; break; *************** *** 2317,2321 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: and_test(); label_16: --- 2317,2321 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: and_test(); label_16: *************** *** 2456,2460 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: comparison(); break; --- 2456,2460 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: comparison(); break; *************** *** 3194,3198 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: power(); break; --- 3194,3198 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: power(); break; *************** *** 3394,3398 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: SmartTestList(); break; --- 3394,3398 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: SmartTestList(); break; *************** *** 3429,3433 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: listmaker(); break; --- 3429,3433 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: listmaker(); break; *************** *** 3484,3488 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: dictmaker(); break; --- 3484,3488 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: dictmaker(); break; *************** *** 3513,3518 **** } break; ! case 113: ! jj_consume_token(113); SmartTestList(); SimpleNode jjtn004 = new SimpleNode(JJTSTR_1OP); --- 3513,3518 ---- } break; ! case 112: ! jj_consume_token(112); SmartTestList(); SimpleNode jjtn004 = new SimpleNode(JJTSTR_1OP); *************** *** 3521,3525 **** jjtreeOpenNodeScope(jjtn004); try { ! jj_consume_token(113); } finally { if (jjtc004) { --- 3521,3525 ---- jjtreeOpenNodeScope(jjtn004); try { ! jj_consume_token(112); } finally { if (jjtc004) { *************** *** 3723,3727 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: SimpleNode jjtn002 = new SimpleNode(JJTSLICE); boolean jjtc002 = true; --- 3723,3727 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: SimpleNode jjtn002 = new SimpleNode(JJTSLICE); boolean jjtc002 = true; *************** *** 3816,3820 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: test(); break; --- 3816,3820 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: test(); break; *************** *** 3845,3849 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: test(); break; --- 3845,3849 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: test(); break; *************** *** 4308,4312 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: normalargs(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { --- 4308,4312 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 112: normalargs(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { *************** *** 5700,5704 **** final private boolean jj_3R_139() { ! if (jj_scan_token(113)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; --- 5700,5704 ---- final private boolean jj_3R_139() { ! if (jj_scan_token(112)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; *************** *** 6612,6616 **** final private int[] jj_la1_1 = {0x90000008,0x90000008,0x90000008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x90000008,0x0,0x90000008,0x80,0x3ff8000,0x0,0x0,0x0,0x0,0x0,0x90000008,0x0,0x0,0x90000008,0x0,0x0,0x0,0xfc000000,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90000008,0x90000008,0x90000008,0x4000000,0x90000008,0x8000000,0x10000008,0x70007f00,0x50007f00,0x20000000,0x20,0x10,0x40,0x3,0x3,0x0,0x0,0x4,0x4,0x8,0x0,0x0,0x0,0x90000008,0x90000008,0x90000008,0x0,0x0,0x0,0x0,0x0,0x90000008,0x90000008,0x90000008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfc000008,0x0,0x0,0x0,0x0,0xfc000000,}; final private int[] jj_la1_2 = {0x1efffdb9,0x1efffdb9,0x1efffdb9,0x0,0xc00000,0x0,0x0,0x0,0xc00000,0x0,0x0,0xc00000,0x0,0x1efffdb9,0x0,0x1efffc00,0x0,0x0,0x0,0x0,0x0,0x400,0x47000,0x1ec00000,0x0,0x0,0x1ec00000,0x18000,0x0,0x0,0xffffff,0x400000,0x0,0x400000,0x0,0x0,0x0,0x0,0x1b9,0x4,0x2,0x2,0x2,0x40,0x2,0x240,0x0,0x1ec00000,0x1efffdb9,0x1efffc00,0x0,0x1ec00000,0x0,0x1ec00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1ec00000,0x0,0x0,0x0,0x1ec00000,0x1ec00000,0x1ec00000,0x0,0x1ec00000,0xc00000,0x0,0x0,0x1ec00000,0x1ec00000,0x1ec00000,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x11,0x11,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1effffff,0x0,0x1e000000,0xc00000,0x0,0xffffff,}; ! final private int[] jj_la1_3 = {0x20078,0x20078,0x20078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20078,0x0,0x20078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20078,0x0,0x0,0x20078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20078,0x20078,0x20078,0x0,0x20078,0x0,0x20078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20078,0x0,0x0,0x0,0x20078,0x20078,0x20078,0x78,0x20078,0x0,0x0,0x0,0x20078,0x20078,0x20078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20078,0x0,0x0,0x0,0x78,0x0,}; final private JJCalls[] jj_2_rtns = new JJCalls[24]; private boolean jj_rescan = false; --- 6612,6616 ---- final private int[] jj_la1_1 = {0x90000008,0x90000008,0x90000008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x90000008,0x0,0x90000008,0x80,0x3ff8000,0x0,0x0,0x0,0x0,0x0,0x90000008,0x0,0x0,0x90000008,0x0,0x0,0x0,0xfc000000,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90000008,0x90000008,0x90000008,0x4000000,0x90000008,0x8000000,0x10000008,0x70007f00,0x50007f00,0x20000000,0x20,0x10,0x40,0x3,0x3,0x0,0x0,0x4,0x4,0x8,0x0,0x0,0x0,0x90000008,0x90000008,0x90000008,0x0,0x0,0x0,0x0,0x0,0x90000008,0x90000008,0x90000008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfc000008,0x0,0x0,0x0,0x0,0xfc000000,}; final private int[] jj_la1_2 = {0x1efffdb9,0x1efffdb9,0x1efffdb9,0x0,0xc00000,0x0,0x0,0x0,0xc00000,0x0,0x0,0xc00000,0x0,0x1efffdb9,0x0,0x1efffc00,0x0,0x0,0x0,0x0,0x0,0x400,0x47000,0x1ec00000,0x0,0x0,0x1ec00000,0x18000,0x0,0x0,0xffffff,0x400000,0x0,0x400000,0x0,0x0,0x0,0x0,0x1b9,0x4,0x2,0x2,0x2,0x40,0x2,0x240,0x0,0x1ec00000,0x1efffdb9,0x1efffc00,0x0,0x1ec00000,0x0,0x1ec00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1ec00000,0x0,0x0,0x0,0x1ec00000,0x1ec00000,0x1ec00000,0x0,0x1ec00000,0xc00000,0x0,0x0,0x1ec00000,0x1ec00000,0x1ec00000,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x11,0x11,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1effffff,0x0,0x1e000000,0xc00000,0x0,0xffffff,}; ! final private int[] jj_la1_3 = {0x10078,0x10078,0x10078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10078,0x0,0x10078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10078,0x0,0x0,0x10078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10078,0x10078,0x10078,0x0,0x10078,0x0,0x10078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10078,0x0,0x0,0x0,0x10078,0x10078,0x10078,0x78,0x10078,0x0,0x0,0x0,0x10078,0x10078,0x10078,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10078,0x0,0x0,0x0,0x78,0x0,}; final private JJCalls[] jj_2_rtns = new JJCalls[24]; private boolean jj_rescan = false; *************** *** 6781,6786 **** final public ParseException generateParseException() { jj_expentries.removeAllElements(); ! boolean[] la1tokens = new boolean[114]; ! for (int i = 0; i < 114; i++) { la1tokens[i] = false; } --- 6781,6786 ---- final public ParseException generateParseException() { jj_expentries.removeAllElements(); ! boolean[] la1tokens = new boolean[113]; ! for (int i = 0; i < 113; i++) { la1tokens[i] = false; } *************** *** 6807,6811 **** } } ! for (int i = 0; i < 114; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; --- 6807,6811 ---- } } ! for (int i = 0; i < 113; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; Index: PythonGrammarConstants.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/PythonGrammarConstants.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -r2.5 -r2.6 *** PythonGrammarConstants.java 2000/12/12 21:16:12 2.5 --- PythonGrammarConstants.java 2001/04/25 18:56:18 2.6 *************** *** 218,227 **** "<token of kind 105>", "<token of kind 106>", - "\"\\\\\\\'\\\'\\\'\"", - "\"\\\\\\\"\\\"\\\"\"", "\"\\r\\n\"", "\"\\n\"", "\"\\r\"", ! "<token of kind 112>", "\"`\"", }; --- 218,226 ---- "<token of kind 105>", "<token of kind 106>", "\"\\r\\n\"", "\"\\n\"", "\"\\r\"", ! "<token of kind 110>", ! "<token of kind 111>", "\"`\"", }; Index: PythonGrammarTokenManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/PythonGrammarTokenManager.java,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -r2.9 -r2.10 *** PythonGrammarTokenManager.java 2000/12/12 21:16:12 2.9 --- PythonGrammarTokenManager.java 2001/04/25 18:56:18 2.10 *************** *** 52,78 **** { case 0: ! if ((active1 & 0x104000000000L) != 0L) { ! jjmatchedKind = 112; return -1; } return -1; case 1: ! if ((active1 & 0x104000000000L) != 0L) ! { ! if (jjmatchedPos == 0) ! { ! jjmatchedKind = 112; ! jjmatchedPos = 0; ! } ! return -1; ! } ! return -1; ! case 2: ! if ((active1 & 0x104000000000L) != 0L) { if (jjmatchedPos == 0) { ! jjmatchedKind = 112; jjmatchedPos = 0; } --- 52,67 ---- { case 0: ! if ((active1 & 0x4000000000L) != 0L) { ! jjmatchedKind = 110; return -1; } return -1; case 1: ! if ((active1 & 0x4000000000L) != 0L) { if (jjmatchedPos == 0) { ! jjmatchedKind = 110; jjmatchedPos = 0; } *************** *** 107,118 **** { case 10: ! return jjStopAtPos(0, 110); case 13: ! jjmatchedKind = 111; ! return jjMoveStringLiteralDfa1_10(0x200000000000L); case 34: return jjMoveStringLiteralDfa1_10(0x4000000000L); - case 92: - return jjMoveStringLiteralDfa1_10(0x100000000000L); default : return jjMoveNfa_10(0, 0); --- 96,105 ---- { case 10: ! return jjStopAtPos(0, 108); case 13: ! jjmatchedKind = 109; ! return jjMoveStringLiteralDfa1_10(0x80000000000L); case 34: return jjMoveStringLiteralDfa1_10(0x4000000000L); default : return jjMoveNfa_10(0, 0); *************** *** 129,137 **** { case 10: ! if ((active1 & 0x200000000000L) != 0L) ! return jjStopAtPos(1, 109); break; case 34: ! return jjMoveStringLiteralDfa2_10(active1, 0x104000000000L); default : break; --- 116,124 ---- { case 10: ! if ((active1 & 0x80000000000L) != 0L) ! return jjStopAtPos(1, 107); break; case 34: ! return jjMoveStringLiteralDfa2_10(active1, 0x4000000000L); default : break; *************** *** 153,181 **** if ((active1 & 0x4000000000L) != 0L) return jjStopAtPos(2, 102); - return jjMoveStringLiteralDfa3_10(active1, 0x100000000000L); - default : break; - } - return jjStartNfa_10(1, 0L, active1); - } - private final int jjMoveStringLiteralDfa3_10(long old1, long active1) - { - if (((active1 &= old1)) == 0L) - return jjStartNfa_10(1, 0L, old1); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_10(2, 0L, active1); - return 3; - } - switch(curChar) - { - case 34: - if ((active1 & 0x100000000000L) != 0L) - return jjStopAtPos(3, 108); - break; default : break; } ! return jjStartNfa_10(2, 0L, active1); } private final void jjCheckNAdd(int state) --- 140,148 ---- if ((active1 & 0x4000000000L) != 0L) return jjStopAtPos(2, 102); break; default : break; } ! return jjStartNfa_10(1, 0L, active1); } private final void jjCheckNAdd(int state) *************** *** 216,220 **** int[] nextStates; int startsAt = 0; ! jjnewStateCnt = 1; int i = 1; jjstateSet[0] = startState; --- 183,187 ---- int[] nextStates; int startsAt = 0; ! jjnewStateCnt = 3; int i = 1; jjstateSet[0] = startState; *************** *** 232,237 **** { case 0: ! if ((0xffffffffffffdbffL & l) != 0L) ! kind = 112; break; default : break; --- 199,208 ---- { case 0: ! if ((0xffffffffffffdbffL & l) != 0L && kind > 110) ! kind = 110; ! break; ! case 2: ! if ((0xffffffffffffdbffL & l) != 0L && kind > 111) ! kind = 111; break; default : break; *************** *** 247,252 **** { case 0: ! kind = 112; break; default : break; } --- 218,234 ---- { case 0: ! if (kind > 110) ! kind = 110; ! if (curChar == 92) ! jjstateSet[jjnewStateCnt++] = 2; break; + case 1: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 2; + break; + case 2: + if (kind > 111) + kind = 111; + break; default : break; } *************** *** 262,267 **** { case 0: ! if ((jjbitVec0[i2] & l2) != 0L && kind > 112) ! kind = 112; break; default : break; --- 244,253 ---- { case 0: ! if ((jjbitVec0[i2] & l2) != 0L && kind > 110) ! kind = 110; ! break; ! case 2: ! if ((jjbitVec0[i2] & l2) != 0L && kind > 111) ! kind = 111; break; default : break; *************** *** 276,280 **** } ++curPos; ! if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } --- 262,266 ---- } ++curPos; ! if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } *************** *** 724,750 **** { case 0: ! if ((active1 & 0x82000000000L) != 0L) { ! jjmatchedKind = 112; return -1; } return -1; case 1: ! if ((active1 & 0x82000000000L) != 0L) ! { ! if (jjmatchedPos == 0) ! { ! jjmatchedKind = 112; ! jjmatchedPos = 0; ! } ! return -1; ! } ! return -1; ! case 2: ! if ((active1 & 0x82000000000L) != 0L) { if (jjmatchedPos == 0) { ! jjmatchedKind = 112; jjmatchedPos = 0; } --- 710,725 ---- { case 0: ! if ((active1 & 0x2000000000L) != 0L) { ! jjmatchedKind = 110; return -1; } return -1; case 1: ! if ((active1 & 0x2000000000L) != 0L) { if (jjmatchedPos == 0) { ! jjmatchedKind = 110; jjmatchedPos = 0; } *************** *** 773,784 **** { case 10: ! return jjStopAtPos(0, 110); case 13: ! jjmatchedKind = 111; ! return jjMoveStringLiteralDfa1_9(0x200000000000L); case 39: return jjMoveStringLiteralDfa1_9(0x2000000000L); - case 92: - return jjMoveStringLiteralDfa1_9(0x80000000000L); default : return jjMoveNfa_9(0, 0); --- 748,757 ---- { case 10: ! return jjStopAtPos(0, 108); case 13: ! jjmatchedKind = 109; ! return jjMoveStringLiteralDfa1_9(0x80000000000L); case 39: return jjMoveStringLiteralDfa1_9(0x2000000000L); default : return jjMoveNfa_9(0, 0); *************** *** 795,803 **** { case 10: ! if ((active1 & 0x200000000000L) != 0L) ! return jjStopAtPos(1, 109); break; case 39: ! return jjMoveStringLiteralDfa2_9(active1, 0x82000000000L); default : break; --- 768,776 ---- { case 10: ! if ((active1 & 0x80000000000L) != 0L) ! return jjStopAtPos(1, 107); break; case 39: ! return jjMoveStringLiteralDfa2_9(active1, 0x2000000000L); default : break; *************** *** 819,847 **** if ((active1 & 0x2000000000L) != 0L) return jjStopAtPos(2, 101); - return jjMoveStringLiteralDfa3_9(active1, 0x80000000000L); - default : - break; - } - return jjStartNfa_9(1, 0L, active1); - } - private final int jjMoveStringLiteralDfa3_9(long old1, long active1) - { - if (((active1 &= old1)) == 0L) - return jjStartNfa_9(1, 0L, old1); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_9(2, 0L, active1); - return 3; - } - switch(curChar) - { - case 39: - if ((active1 & 0x80000000000L) != 0L) - return jjStopAtPos(3, 107); break; default : break; } ! return jjStartNfa_9(2, 0L, active1); } private final int jjMoveNfa_9(int startState, int curPos) --- 792,800 ---- if ((active1 & 0x2000000000L) != 0L) return jjStopAtPos(2, 101); break; default : break; } ! return jjStartNfa_9(1, 0L, active1); } private final int jjMoveNfa_9(int startState, int curPos) *************** *** 849,853 **** int[] nextStates; int startsAt = 0; ! jjnewStateCnt = 1; int i = 1; jjstateSet[0] = startState; --- 802,806 ---- int[] nextStates; int startsAt = 0; ! jjnewStateCnt = 3; int i = 1; jjstateSet[0] = startState; *************** *** 865,871 **** { case 0: ! if ((0xffffffffffffdbffL & l) != 0L) ! kind = 112; break; default : break; } --- 818,828 ---- { case 0: ! if ((0xffffffffffffdbffL & l) != 0L && kind > 110) ! kind = 110; break; + case 2: + if ((0xffffffffffffdbffL & l) != 0L && kind > 111) + kind = 111; + break; default : break; } *************** *** 880,885 **** { case 0: ! kind = 112; break; default : break; } --- 837,853 ---- { case 0: ! if (kind > 110) ! kind = 110; ! if (curChar == 92) ! jjstateSet[jjnewStateCnt++] = 2; break; + case 1: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 2; + break; + case 2: + if (kind > 111) + kind = 111; + break; default : break; } *************** *** 895,901 **** { case 0: ! if ((jjbitVec0[i2] & l2) != 0L && kind > 112) ! kind = 112; break; default : break; } --- 863,873 ---- { case 0: ! if ((jjbitVec0[i2] & l2) != 0L && kind > 110) ! kind = 110; break; + case 2: + if ((jjbitVec0[i2] & l2) != 0L && kind > 111) + kind = 111; + break; default : break; } *************** *** 909,913 **** } ++curPos; ! if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } --- 881,885 ---- } ++curPos; ! if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } *************** *** 1206,1210 **** return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x0L); case 96: ! return jjStopAtPos(0, 113); case 97: return jjMoveStringLiteralDfa1_0(0x800000000000000L, 0x600000L); --- 1178,1182 ---- return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x0L); case 96: ! return jjStopAtPos(0, 112); case 97: return jjMoveStringLiteralDfa1_0(0x800000000000000L, 0x600000L); *************** *** 2414,2418 **** "\147\154\157\142\141\154", "\145\170\145\143", "\141\163\163\145\162\164", "\141\163", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, ! null, null, null, null, null, null, null, null, null, "\140", }; public static final String[] lexStateNames = { "DEFAULT", --- 2386,2390 ---- "\147\154\157\142\141\154", "\145\170\145\143", "\141\163\163\145\162\164", "\141\163", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, ! null, null, null, null, null, null, null, null, "\140", }; public static final String[] lexStateNames = { "DEFAULT", *************** *** 2433,2440 **** -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 9, 10, 0, ! 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { ! 0xfffffffffffec1c1L, 0x200781effffffL, }; static final long[] jjtoSkip = { --- 2405,2412 ---- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 9, 10, 0, ! 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { ! 0xfffffffffffec1c1L, 0x100781effffffL, }; static final long[] jjtoSkip = { *************** *** 2445,2449 **** }; static final long[] jjtoMore = { ! 0x0L, 0x1ff8780000000L, }; private ASCII_CharStream input_stream; --- 2417,2421 ---- }; static final long[] jjtoMore = { ! 0x0L, 0xff8780000000L, }; private ASCII_CharStream input_stream; *************** *** 2786,2790 **** image.setLength(image.length()-2); break; ! case 109 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen))); --- 2758,2762 ---- image.setLength(image.length()-2); break; ! case 107 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen))); *************** *** 2796,2800 **** image.setCharAt(l-2, '\n'); break; ! case 111 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen))); --- 2768,2772 ---- image.setCharAt(l-2, '\n'); break; ! case 109 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen))); |
From: Finn B. <bc...@us...> - 2001-04-25 18:47:22
|
Update of /cvsroot/jython/jython/org/python/parser In directory usw-pr-cvs1:/tmp/cvs-serv28124 Modified Files: python.jjt Log Message: Fix bug #410794: cannot escape trailing " in a """ string Index: python.jjt =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/python.jjt,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -r2.12 -r2.13 *** python.jjt 2000/12/12 21:19:10 2.12 --- python.jjt 2001/04/25 18:47:19 2.13 *************** *** 358,363 **** <IN_STRING11> MORE: { <("\\" ("\\"|"'")) | ~["\n","\r"]> } <IN_STRING21> MORE: { <("\\" ("\\"|"\"")) | ~["\n","\r"]> } - <IN_STRING13> MORE: { "\\'''" } - <IN_STRING23> MORE: { "\\\"\"\"" } <IN_STRING13, IN_STRING23> MORE: --- 358,361 ---- *************** *** 371,374 **** --- 369,373 ---- | <"\r"> { image.setCharAt(image.length()-1, '\n'); } | <~["\n","\r"]> + | <"\\" ~["\n","\r"]> } |
From: Finn B. <bc...@us...> - 2001-04-25 18:39:26
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv26074 Modified Files: PyClass.java Log Message: PyClass.__setattr__(): Fix #409930. Allow assignment to __bases__, __name__ and __dict__. Index: PyClass.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyClass.java,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -r2.23 -r2.24 *** PyClass.java 2001/03/22 20:02:49 2.23 --- PyClass.java 2001/04/25 18:39:24 2.24 *************** *** 215,221 **** public void __setattr__(String name, PyObject value) { ! if (name == "__dict__" || name == "__name__" || name == "__bases__") { ! throw Py.TypeError("read-only special attribute: "+name); } __dict__.__setitem__(name, value); } --- 215,237 ---- public void __setattr__(String name, PyObject value) { ! if (name == "__dict__") { ! if (!value.isMappingType()) ! throw Py.TypeError("__dict__ must be a dictionary object"); ! __dict__ = value; ! return; } + if (name == "__name__") { + if (!(value instanceof PyString)) + throw Py.TypeError("__name__ must be a string object"); + __name__ = value.toString(); + return; + } + if (name == "__bases__") { + if (!(value instanceof PyTuple)) + throw Py.TypeError("__bases__ must be a tuple object"); + __bases__ = (PyTuple) value; + return; + } + __dict__.__setitem__(name, value); } |