From: <th...@us...> - 2008-08-29 21:59:56
|
Revision: 5272 http://jython.svn.sourceforge.net/jython/?rev=5272&view=rev Author: thobes Date: 2008-08-29 21:59:51 +0000 (Fri, 29 Aug 2008) Log Message: ----------- Committing a large portion of code to the advanced compiler project. The advanced compiler is mostly outlined, there quite a few implementation details to complete, but I have a good idea and direction for implementing these. Further details on content, direction and status of the project can be found in BRANCH.txt Modified Paths: -------------- branches/advanced/.classpath branches/advanced/BRANCH.txt branches/advanced/Lib/_ast.py branches/advanced/build.xml branches/advanced/src/org/python/antlr/Visitor.java branches/advanced/src/org/python/compiler/Future.java branches/advanced/src/org/python/core/CompilerFacade.java branches/advanced/src/org/python/core/FutureFeature.java branches/advanced/src/org/python/core/Py.java branches/advanced/src/org/python/core/PyEllipsis.java branches/advanced/src/org/python/core/PyNone.java branches/advanced/src/org/python/core/PyNotImplemented.java branches/advanced/src/org/python/core/PythonCompiler.java Added Paths: ----------- branches/advanced/compiler/org/python/code/ArgumentParser.java branches/advanced/compiler/org/python/compiler/AdvancedCompiler.java branches/advanced/compiler/org/python/compiler/AdvancedPreferences.java branches/advanced/compiler/org/python/compiler/CodeGenerator.java branches/advanced/compiler/org/python/compiler/CompilerDirector.java branches/advanced/compiler/org/python/compiler/ConstantChecker.java branches/advanced/compiler/org/python/compiler/ConstraintsDefinition.java branches/advanced/compiler/org/python/compiler/FlowGraphBundle.java branches/advanced/compiler/org/python/compiler/FlowGraphGenerator.java branches/advanced/compiler/org/python/compiler/GeneratedCodeState.java branches/advanced/compiler/org/python/compiler/IntermediateCodeGenerator.java branches/advanced/compiler/org/python/compiler/IntermediateCodeGeneratorFactory.java branches/advanced/compiler/org/python/compiler/PragmaParser.java branches/advanced/compiler/org/python/compiler/ScopeBuilder.java branches/advanced/compiler/org/python/compiler/ScopeFactory.java branches/advanced/compiler/org/python/compiler/ScopeInformation.java branches/advanced/compiler/org/python/compiler/ScopesBuilder.java branches/advanced/compiler/org/python/compiler/SyntaxErrorPolicy.java branches/advanced/compiler/org/python/compiler/flowgraph/ branches/advanced/compiler/org/python/compiler/flowgraph/Block.java branches/advanced/compiler/org/python/compiler/flowgraph/CodeGraph.java branches/advanced/compiler/org/python/compiler/flowgraph/Constant.java branches/advanced/compiler/org/python/compiler/flowgraph/FilteredGraph.java branches/advanced/compiler/org/python/compiler/flowgraph/IfGroup.java branches/advanced/compiler/org/python/compiler/flowgraph/Link.java branches/advanced/compiler/org/python/compiler/flowgraph/LinkGroup.java branches/advanced/compiler/org/python/compiler/flowgraph/LoopGroup.java branches/advanced/compiler/org/python/compiler/flowgraph/SuperBlock.java branches/advanced/compiler/org/python/compiler/flowgraph/Transformer.java branches/advanced/compiler/org/python/compiler/flowgraph/TryFinallyGroup.java branches/advanced/compiler/org/python/compiler/flowgraph/ValueOperation.java branches/advanced/compiler/org/python/compiler/flowgraph/Variable.java branches/advanced/compiler/org/python/compiler/flowgraph/VoidOperation.java branches/advanced/src/org/python/compiler/LegacyCompiler.java branches/advanced/src/org/python/core/Pragma.java branches/advanced/src/org/python/core/PragmaReceiver.java branches/advanced/src/org/python/core/PythonCodeBundle.java Modified: branches/advanced/.classpath =================================================================== --- branches/advanced/.classpath 2008-08-29 21:08:52 UTC (rev 5271) +++ branches/advanced/.classpath 2008-08-29 21:59:51 UTC (rev 5272) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="lib" path="build/exposed"/> - <classpathentry excluding="com/ziclix/python/sql/handler/InformixDataHandler.java|com/ziclix/python/sql/handler/OracleDataHandler.java|org/python/compiler/TentativeCompiler.java" kind="src" output="build/classes" path="src"/> + <classpathentry excluding="com/ziclix/python/sql/handler/InformixDataHandler.java|com/ziclix/python/sql/handler/OracleDataHandler.java|org/python/compiler/TentativeCompiler.java|org/python/util/MultipleEnumSet.java" kind="src" output="build/classes" path="src"/> <classpathentry kind="src" output="build/classes" path="build/gensrc"/> <classpathentry kind="src" output="build/classes" path="tests/java"/> <classpathentry kind="src" path="bugtests/classes"/> Modified: branches/advanced/BRANCH.txt =================================================================== --- branches/advanced/BRANCH.txt 2008-08-29 21:08:52 UTC (rev 5271) +++ branches/advanced/BRANCH.txt 2008-08-29 21:59:51 UTC (rev 5272) @@ -2,4 +2,89 @@ ======================== The advanced compiler is a project that strives to add an optimizing, advanced -compiler to Jython. \ No newline at end of file +compiler to Jython. + +The content of this branch: + [Most of the code relevant for the advanced compiler package is in the + compiler source directory, only minor modifications has been made in the + src source directory] + * org.python.compiler.bytecode and org.python.bytecode + The first approach for implementing the Advanced compiler, an abstraction + utilizing Python Bytecode as an API and a model for generating and + transforming code before handing it over to the JVM. + This prooved to be too hard to work with in terms of modeling aspects + important for performance on the JVM. + This could still be useful for the ability to import pbc files to Jython, + as made possible during Summer of Code 2007. It might also be useful for + implementing dynamic evaluation of Python code in environments where + it is not possible to generate and load Java byte code, such as in + restricted environments (for example applets) or on other platforms, + such as Android. + * org.python.compiler.advanced + The second attempt at implementing the Advanced compiler, or at least the + API part of it. + This suffered from trying to be too general, extensible and decoupled. + It was a good experience though. + * org.python.compiler.flowgrah + The third and current implementation of the Advanced compiler. + Using a flow graph as an intermediate representation. + The code for generating the flow graph is in the org.python.compiler package. + The state of this implementation is: + * The guts of the flow graph representation has not been implemented yet, + it is at an API design stage. + * The code for generating the data flow of the flow graph has been + implemented. Although it might have to be refactored when the internals + of the flow graph is implemented, since that might imply some API changes. + * The code for generating the control flow of the flow graph is being + implemented. It started out as being a simple flow between arbitrary + blocks in the graph, but it turns out that there will be some gain in + having the flow graph be built from graph patterns. This lead to quite a + large refactoring of the control flow aspects of the flow graph API. + * The code for annotating the flow graph and for turning the flow graph into + Java bytecode is only at an "ideas on a piece of paper" stage at the + moment. + +The flow of the compiler will be: + Step 1. Parse the source text and build an abstract syntax tree. + This is already implemented, the advanced compiler uses the same AST as + the legacy compiler. + * Optionally any AST transformations that the user has added to the compiler + will be applied after step 1. + Step 2. Verify AST constraints and build up information about the scopes. + This has been mostly implemented, but some pieces of the representation + of the scope information data structure is still under development. + The AST verification adds constraints that are expensive to apply in the + parsing step. Such as scope rules, restricted values, illegal combinations + of nodes and such things. + Step 3. Transform the AST to a flow graph representation. + This is being implemented, see above. + * Optionally apply any flow graph transformations here. + These transformations will typically be type annotations and optimizations. + For this a transformation API for the flow graph is required, this will be + designed when the first transformations are implemented. It will need to + have good support for things such as inlining, loop unrolling and + code substitution. This is where it makes a large difference to have the + controll flow of the flow graph be built from a set of graph patterns + instead of an arbitrary flow structure. + Step 4. Generate target code (Java byte code) from the flow graph. + This has not been implemented yet, see above. + +Annother aspect that needs to be implemeted is serialization of the flow graph, +this is needed to enable reloading it at runtime and specialize it given the +runtime data types. This would be a Python aware pre-JIT optimizer (the JVM +JIT is good, but it can get a lot of help from a layer of language awareness). +Serializability has been in mind when designing the flow graph representation, +but it has not been the main focus. +These optimizations could be more agressive than the once in the transformation +step in between steps 3 and 4, but would use the same API. Perhaps triggers +could be added in the "static transformation" to alert the runtime system when +certain optimizations might be applicable in the "JIT transformation" step. + +A summary of the things left to do (in chronological order): + * Design the control flow aspect of the flow graph API. + * Finish the flow graph generation given the control flow API. + * Implement the internals of the flow graph. + * Implement byte code generation from the flow graph. + * Implement transformations of the flow graph. +Here the advanced compiler will be working. After this comes the just in time +re-compilation project. Modified: branches/advanced/Lib/_ast.py =================================================================== --- branches/advanced/Lib/_ast.py 2008-08-29 21:08:52 UTC (rev 5271) +++ branches/advanced/Lib/_ast.py 2008-08-29 21:59:51 UTC (rev 5272) @@ -2,7 +2,7 @@ from org.python.antlr.ast.operatorType import Add,Sub,Mult,Div,FloorDiv,Mod,LShift,RShift,BitOr,BitAnd,BitXor,Pow from org.python.antlr.ast.cmpopType import Eq,Gt,GtE,In,Is,IsNot,Lt,LtE,NotEq,NotIn from org.python.antlr.ast.unaryopType import Invert,Not,UAdd,USub -from org.python.core.PyTableCode import PyCF_ONLY_AST +from org.python.core.CompilerFlags import PyCF_ONLY_AST from org.python.antlr.ast.expr_contextType import Load, Store, Del, AugLoad, AugStore, Param from org.python.antlr import AST Modified: branches/advanced/build.xml =================================================================== --- branches/advanced/build.xml 2008-08-29 21:08:52 UTC (rev 5271) +++ branches/advanced/build.xml 2008-08-29 21:59:51 UTC (rev 5272) @@ -480,6 +480,7 @@ <src path="${interpreter.source.dir}"/> <exclude name="org/python/parser/python.java" /> + <exclude name="**/MultipleEnumSet.java" /> <exclude name="**/handler/InformixDataHandler.java" unless="informix.present" /> <exclude name="**/handler/OracleDataHandler.java" unless="oracle.present" /> <classpath refid="main.classpath" /> Added: branches/advanced/compiler/org/python/code/ArgumentParser.java =================================================================== --- branches/advanced/compiler/org/python/code/ArgumentParser.java (rev 0) +++ branches/advanced/compiler/org/python/code/ArgumentParser.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,48 @@ +package org.python.code; + +import java.util.LinkedList; +import java.util.List; + +import org.python.core.PyDictionary; +import org.python.core.PyObject; +import org.python.core.PyTuple; + +/** + * Work in progress: an outline for an argument parser based on a perfect hash. + * + * @author Tobias Ivarsson + */ +public class ArgumentParser { + + public static PyObject[] parse(ArgumentParser spec, PyObject[] arguments, + String[] keywords, PyObject star, PyDictionary starstar) { + PyObject[] result = new PyObject[totalArgSize(spec)]; + List<PyObject> stararg; + PyDictionary kwstararg; + if (spec.has_kwstararg) { + kwstararg = spec.has_kwstararg ? new PyDictionary() : null; + result[result.length - 1] = kwstararg; + } + + stararg = spec.has_stararg ? new LinkedList<PyObject>() : null; + + if (stararg != null) { + PyObject[] elements = new PyObject[stararg.size()]; + elements = stararg.toArray(elements); + result[result.length - (1 + (spec.has_kwstararg ? 1 : 0))] = new PyTuple( + elements); + } + return result; + } + + private int argcount; + private boolean has_stararg; + private boolean has_kwstararg; + private int positionalonlycount; + + private static int totalArgSize(ArgumentParser spec) { + return spec.argcount + (spec.has_stararg ? 1 : 0) + + spec.positionalonlycount + (spec.has_kwstararg ? 1 : 0); + } + +} Added: branches/advanced/compiler/org/python/compiler/AdvancedCompiler.java =================================================================== --- branches/advanced/compiler/org/python/compiler/AdvancedCompiler.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/AdvancedCompiler.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,73 @@ +package org.python.compiler; + +import java.util.HashMap; +import java.util.Map; + +import org.python.antlr.PythonTree; +import org.python.antlr.ast.Module; +import org.python.antlr.ast.VisitorBase; +import org.python.antlr.ast.VisitorIF; +import org.python.antlr.ast.modType; +import org.python.compiler.flowgraph.Transformer; +import org.python.compiler.flowgraph.Variable; +import org.python.core.CompilerFlags; +import org.python.core.ParserFacade; +import org.python.core.PythonCodeBundle; +import org.python.core.PythonCompiler; + +public class AdvancedCompiler implements PythonCompiler { + + private VisitorIF<?> astTransformer; + private final Transformer flowgraphTransformations = null; // TODO + private final AdvancedPreferences preferences = null; + private final CodeGenerator codegen = new CodeGenerator() { + // This depends on the preferences + }; + + public PythonCodeBundle compile(modType node, String name, String filename, + boolean linenumbers, boolean printResults, boolean setFile, + CompilerFlags cflags) throws Exception { + if (astTransformer != null) { + node.accept(astTransformer); + } + FlowGraphBundle bundle = new FlowGraphBundle(name, filename); + CompilerDirector.compile(bundle, preferences, cflags, linenumbers, + printResults, setFile, node); + bundle.acceptTransformations(flowgraphTransformations); + return bundle.generateCode(codegen); + } + + public static Map<PythonTree, ScopeInformation> test(String source) throws Exception { + return testScopeAnalyzer(ParserFacade.parse(source, "exec")); + } + + private static Map<PythonTree, ScopeInformation> testScopeAnalyzer( + PythonTree parse) throws Exception { + return parse.accept(new VisitorBase<Map<PythonTree, ScopeInformation>>() { + + @Override + public void traverse(PythonTree node) throws Exception { + } + + @Override + protected Map<PythonTree, ScopeInformation> unhandled_node( + PythonTree node) throws Exception { + return null; + } + + @Override + public Map<PythonTree, ScopeInformation> visitModule(Module node) + throws Exception { + FlowGraphBundle bundle = new FlowGraphBundle("data", "data.fil"); + Map<PythonTree, ScopeInformation> scopes = new HashMap<PythonTree, ScopeInformation>(); + ScopeInformation scope = ScopesBuilder.scan( + new SyntaxErrorPolicy.ErrorCollectingPolicy(), null, + new HashMap<String, ConstantChecker<Variable>>(), + scopes, bundle, node.body); + scopes.put(node, scope); + return scopes; + } + }); + } + +} Added: branches/advanced/compiler/org/python/compiler/AdvancedPreferences.java =================================================================== --- branches/advanced/compiler/org/python/compiler/AdvancedPreferences.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/AdvancedPreferences.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,121 @@ +package org.python.compiler; + +import java.util.Map; + +import org.python.antlr.ast.Name; +import org.python.antlr.ast.Num; +import org.python.antlr.ast.exprType; +import org.python.compiler.flowgraph.CodeGraph; +import org.python.compiler.flowgraph.Variable; +import org.python.core.CompilerFlags; +import org.python.core.Py; + +public class AdvancedPreferences implements ConstraintsDefinition<Variable> { + + private interface Setting<T> { + + } + + private enum Booleans implements Setting<Boolean> { + BOOLEAN_CONSTANTS, CORE_CONSTANTS + + } + + private enum Strings implements Setting<String> { + + } + + private enum Numbers implements Setting<Number> { + + } + + private enum Constant implements ConstantChecker<Variable> { + NONE { + + @Override + public boolean acceptValue(exprType value) { + return (value instanceof Name) + && ((Name) value).id.equals("None"); + } + + @Override + public Variable getConstantValue() { + return CodeGraph.None(); + } + }, + ELLIPSIS { + + @Override + public boolean acceptValue(exprType value) { + return (value instanceof Name) + && ((Name) value).id.equals("Ellipsis"); + } + + @Override + public Variable getConstantValue() { + return CodeGraph.Ellipsis(); + } + }, + TRUE { + + @Override + public boolean acceptValue(exprType value) { + if (value instanceof Num) { + Num num = (Num) value; + return num.equals(1) || num.equals(Py.newInteger(1)); + } else if (value instanceof Name) { + Name name = (Name) value; + return name.id.equals("True"); + } + return false; + } + + @Override + public Variable getConstantValue() { + return CodeGraph.True(); + } + }, + FALSE { + + @Override + public boolean acceptValue(exprType value) { + if (value instanceof Num) { + Num num = (Num) value; + return num.equals(0) || num.equals(Py.newInteger(0)); + } else if (value instanceof Name) { + Name name = (Name) value; + return name.id.equals("False"); + } + return false; + } + + @Override + public Variable getConstantValue() { + return CodeGraph.False(); + } + }; + + public abstract boolean acceptValue(exprType value); + + public abstract Variable getConstantValue(); + + } + + private <T> T getSetting(Setting<T> boolean_constants, CompilerFlags flags) { + // TODO Auto-generated method stub + return null; + } + + public void update(CompilerFlags flags, + Map<String, ConstantChecker<Variable>> constNames) { + // TODO + if (getSetting(Booleans.CORE_CONSTANTS, flags)) { + constNames.put("None", Constant.NONE); + } + if (getSetting(Booleans.BOOLEAN_CONSTANTS, flags)) { + constNames.put("True", Constant.TRUE); + constNames.put("False", Constant.FALSE); + } + } + +} Added: branches/advanced/compiler/org/python/compiler/CodeGenerator.java =================================================================== --- branches/advanced/compiler/org/python/compiler/CodeGenerator.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/CodeGenerator.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,10 @@ +package org.python.compiler; + +/** + * Generates executable code from the Intermediate Representation. + * + * @author Tobias Ivarsson + */ +interface CodeGenerator { + +} Added: branches/advanced/compiler/org/python/compiler/CompilerDirector.java =================================================================== --- branches/advanced/compiler/org/python/compiler/CompilerDirector.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/CompilerDirector.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,177 @@ +package org.python.compiler; + +import java.util.HashMap; +import java.util.Map; + +import org.python.antlr.PythonTree; +import org.python.antlr.ast.ClassDef; +import org.python.antlr.ast.Expression; +import org.python.antlr.ast.FunctionDef; +import org.python.antlr.ast.GeneratorExp; +import org.python.antlr.ast.Interactive; +import org.python.antlr.ast.Lambda; +import org.python.antlr.ast.Return; +import org.python.antlr.ast.VisitorBase; +import org.python.antlr.ast.modType; +import org.python.antlr.ast.stmtType; +import org.python.core.CompilerFlags; +import org.python.core.FutureFeature; + +class CompilerDirector<E, S, H> extends VisitorBase<E> { + + private static final PragmaParser interactivePragmas = new PragmaParser( + FutureFeature.PRAGMA_MODULE); + private static final PragmaParser modulePragmas = new PragmaParser( + FutureFeature.PRAGMA_MODULE); + private final CompilerFlags flags; + private final SyntaxErrorPolicy errorPolicy = null; + private final Map<PythonTree, S> scopes = new HashMap<PythonTree, S>(); + private IntermediateCodeGenerator<E, S, H> codegen; + private final boolean printResults; + private final boolean linenumbers; // TODO + private final boolean setFile; // TODO + private final IntermediateCodeGeneratorFactory<E, S, H> factory; + private final ConstraintsDefinition<E> constraints; + private final Map<String, ConstantChecker<E>> constNames = new HashMap<String, ConstantChecker<E>>(); + + public static <E, S, H> void compile( + IntermediateCodeGeneratorFactory<E, S, H> factory, + ConstraintsDefinition<E> constraints, CompilerFlags cflags, + boolean linenumbers, boolean printResults, boolean setFile, + modType base) throws Exception { + base.accept(new CompilerDirector<E, S, H>(factory, constraints, cflags, + linenumbers, printResults, setFile)); + } + + private CompilerDirector(IntermediateCodeGeneratorFactory<E, S, H> factory, + ConstraintsDefinition<E> constraints, CompilerFlags cflags, + boolean linenumbers, boolean printResults, boolean setFile) { + this.factory = factory; + this.constraints = constraints; + this.printResults = printResults; + this.linenumbers = linenumbers; + this.setFile = setFile; + // TODO copy the compiler flags + flags = new CompilerFlags(); + } + + @Override + public void traverse(PythonTree node) throws Exception { + // Don't do anything, the traversal is handled by the code generator + } + + @Override + protected E unhandled_node(PythonTree node) throws Exception { + // Not explicitly handled by this? then it has to be handled by the code generator + return node.accept(codegen); + } + + // Top level elements - initialize the compiler + + @Override + public E visitModule(org.python.antlr.ast.Module node) throws Exception { + compile(modulePragmas, false, node.body); + return null; + } + + @Override + public E visitInteractive(Interactive node) throws Exception { + compile(interactivePragmas, printResults, node.body); + return null; + } + + @Override + public E visitExpression(Expression node) throws Exception { + compile(null, false, new Return(node, node.body)); + return null; + } + + private void compile(PragmaParser pragmas, boolean printResults, + stmtType... body) throws Exception { + if (pragmas != null) { + pragmas.parse(body, flags); + } + constraints.update(flags, constNames); + S scope = ScopesBuilder.scan(errorPolicy, pragmas, constNames, scopes, + factory, body); + IntermediateCodeGenerator<E, S, H> old = codegen; + try { + // TODO: pass on the flags as well... + codegen = factory.createCodeGenerator(printResults, constNames, + this, scope); + for (stmtType stmt : body) { + stmt.accept(this); + } + } finally { + codegen = old; + } + } + + // Scope defining elements + + @Override + public E visitClassDef(ClassDef node) throws Exception { + S scope = scopes.get(node); + H state = codegen.beforeClassDef(node, scope); + IntermediateCodeGenerator<E, S, H> old = codegen; + E result; + try { + codegen = factory.createCodeGenerator(false, constNames, this, + scope); + result = codegen.visitClassDef(node); + } finally { + codegen = old; + } + codegen.afterClassDef(node, state, result); + return result; + } + + @Override + public E visitFunctionDef(FunctionDef node) throws Exception { + S scope = scopes.get(node); + H state = codegen.beforeFunctionDef(node, scope); + IntermediateCodeGenerator<E, S, H> old = codegen; + E result; + try { + codegen = factory.createCodeGenerator(false, constNames, this, + scope); + result = codegen.visitFunctionDef(node); + } finally { + codegen = old; + } + codegen.afterFunctionDef(node, state, result); + return result; + } + + @Override + public E visitLambda(Lambda node) throws Exception { + S scope = scopes.get(node); + H state = codegen.beforeLambda(node, scope); + IntermediateCodeGenerator<E, S, H> old = codegen; + E result; + try { + codegen = factory.createCodeGenerator(false, constNames, this, + scope); + result = codegen.visitLambda(node); + } finally { + codegen = old; + } + return codegen.afterLambda(node, state, result); + } + + @Override + public E visitGeneratorExp(GeneratorExp node) throws Exception { + S scope = scopes.get(node); + H state = codegen.beforeGeneratorExp(node, scope); + IntermediateCodeGenerator<E, S, H> old = codegen; + E result; + try { + codegen = factory.createCodeGenerator(false, constNames, this, + scope); + result = codegen.visitGeneratorExp(node); + } finally { + codegen = old; + } + return codegen.afterGeneratorExp(node, state, result); + } +} \ No newline at end of file Added: branches/advanced/compiler/org/python/compiler/ConstantChecker.java =================================================================== --- branches/advanced/compiler/org/python/compiler/ConstantChecker.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/ConstantChecker.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,11 @@ +package org.python.compiler; + +import org.python.antlr.ast.exprType; + +public interface ConstantChecker<T> { + + boolean acceptValue(exprType value); + + T getConstantValue(); + +} Added: branches/advanced/compiler/org/python/compiler/ConstraintsDefinition.java =================================================================== --- branches/advanced/compiler/org/python/compiler/ConstraintsDefinition.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/ConstraintsDefinition.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,11 @@ +package org.python.compiler; + +import java.util.Map; + +import org.python.core.CompilerFlags; + +interface ConstraintsDefinition<E> { + + void update(CompilerFlags flags, Map<String, ConstantChecker<E>> constNames); + +} Added: branches/advanced/compiler/org/python/compiler/FlowGraphBundle.java =================================================================== --- branches/advanced/compiler/org/python/compiler/FlowGraphBundle.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/FlowGraphBundle.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,71 @@ +package org.python.compiler; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.python.antlr.ast.VisitorIF; +import org.python.compiler.flowgraph.CodeGraph; +import org.python.compiler.flowgraph.Transformer; +import org.python.compiler.flowgraph.Variable; +import org.python.core.PythonCodeBundle; + +/** + * Represents the super graph of a compilation unit. + * + * @author Tobias Ivarsson + */ +final class FlowGraphBundle + implements + IntermediateCodeGeneratorFactory<Variable, ScopeInformation, GeneratedCodeState> { + + private final String name; + private final String filename; + private final Map<Object, Variable> constantPool = new HashMap<Object, Variable>(); + + public FlowGraphBundle(String name, String filename) { + this.name = name; + this.filename = filename; + } + + void acceptTransformations(Transformer transformer) { + // TODO Auto-generated method stub + + } + + PythonCodeBundle generateCode(CodeGenerator codegen) { + return null; + } + + public IntermediateCodeGenerator<Variable, ScopeInformation, GeneratedCodeState> createCodeGenerator( + boolean printExpr, + Map<String, ConstantChecker<Variable>> constants, + VisitorIF<Variable> driver, ScopeInformation scope) { + CodeGraph graph = new CodeGraph(); + return new FlowGraphGenerator(printExpr, driver, constants, graph); + } + + public ScopeInformation createClass(String name, String[] locals, + String[] explicitlyGlobal, String[] explicitlyClosure, + String[] free, String[] scopeRequired, boolean hasStarImport, + List<ScopeInformation> children) { + return ScopeInformation.makeClassScope(name, locals, explicitlyGlobal, + explicitlyClosure, free, scopeRequired, hasStarImport, children); + } + + public ScopeInformation createFunction(String name, String[] parameters, + String[] locals, String[] explicitlyGlobal, + String[] explicitlyClosure, String[] free, String[] scopeRequired, + boolean isGenerator, boolean hasStarImport, + List<ScopeInformation> children) { + return ScopeInformation.makeFunctionScope(name, parameters, locals, + explicitlyGlobal, explicitlyClosure, free, scopeRequired, + isGenerator, hasStarImport, children); + } + + public ScopeInformation createGlobal(String[] locals, String[] cell, + boolean hasStarImport, List<ScopeInformation> children) { + return ScopeInformation.makeGlobalScope(locals, cell, hasStarImport, + children); + } +} Added: branches/advanced/compiler/org/python/compiler/FlowGraphGenerator.java =================================================================== --- branches/advanced/compiler/org/python/compiler/FlowGraphGenerator.java (rev 0) +++ branches/advanced/compiler/org/python/compiler/FlowGraphGenerator.java 2008-08-29 21:59:51 UTC (rev 5272) @@ -0,0 +1,1030 @@ +package org.python.compiler; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.Stack; +import java.util.Vector; + +import org.python.antlr.ParseException; +import org.python.antlr.PythonTree; +import org.python.antlr.ast.Assert; +import org.python.antlr.ast.Assign; +import org.python.antlr.ast.Attribute; +import org.python.antlr.ast.AugAssign; +import org.python.antlr.ast.BinOp; +import org.python.antlr.ast.BoolOp; +import org.python.antlr.ast.Break; +import org.python.antlr.ast.Call; +import org.python.antlr.ast.ClassDef; +import org.python.antlr.ast.Compare; +import org.python.antlr.ast.Continue; +import org.python.antlr.ast.Delete; +import org.python.antlr.ast.Dict; +import org.python.antlr.ast.Ellipsis; +import org.python.antlr.ast.Exec; +import org.python.antlr.ast.Expr; +import org.python.antlr.ast.ExtSlice; +import org.python.antlr.ast.For; +import org.python.antlr.ast.FunctionDef; +import org.python.antlr.ast.GeneratorExp; +import org.python.antlr.ast.Global; +import org.python.antlr.ast.If; +import org.python.antlr.ast.IfExp; +import org.python.antlr.ast.Import; +import org.python.antlr.ast.ImportFrom; +import org.python.antlr.ast.Index; +import org.python.antlr.ast.Lambda; +import org.python.antlr.ast.List; +import org.python.antlr.ast.ListComp; +import org.python.antlr.ast.Name; +import org.python.antlr.ast.Num; +import org.python.antlr.ast.Pass; +import org.python.antlr.ast.Print; +import org.python.antlr.ast.Raise; +import org.python.antlr.ast.Repr; +import org.python.antlr.ast.Return; +import org.python.antlr.ast.Slice; +import org.python.antlr.ast.Str; +import org.python.antlr.ast.Subscript; +import org.python.antlr.ast.Suite; +import org.python.antlr.ast.TryExcept; +import org.python.antlr.ast.TryFinally; +import org.python.antlr.ast.Tuple; +import org.python.antlr.ast.UnaryOp; +import org.python.antlr.ast.Unicode; +import org.python.antlr.ast.VisitorBase; +import org.python.antlr.ast.VisitorIF; +import org.python.antlr.ast.While; +import org.python.antlr.ast.With; +import org.python.antlr.ast.Yield; +import org.python.antlr.ast.aliasType; +import org.python.antlr.ast.cmpopType; +import org.python.antlr.ast.comprehensionType; +import org.python.antlr.ast.exprType; +import org.python.antlr.ast.operatorType; +import org.python.antlr.ast.sliceType; +import org.python.antlr.ast.stmtType; +import org.python.antlr.ast.unaryopType; +import org.python.compiler.flowgraph.Block; +import org.python.compiler.flowgraph.CodeGraph; +import org.python.compiler.flowgraph.Link; +import org.python.compiler.flowgraph.LinkGroup; +import org.python.compiler.flowgraph.ValueOperation; +import org.python.compiler.flowgraph.Variable; +import org.python.compiler.flowgraph.VoidOperation; + +/** + * @author Tobias Ivarsson + */ +public class FlowGraphGenerator extends VisitorBase<Variable> + implements + IntermediateCodeGenerator<Variable, ScopeInformation, GeneratedCodeState> { + + private static class BreakAction { + + private final Block onBreak; + private final Block onContinue; + private final LinkGroup loop; + + public BreakAction(LinkGroup loop, Block onBreak, Block onContinue) { + this.loop = loop; + this.onBreak = onBreak; + this.onContinue = onContinue; + } + + } + + //private final CompilerDirector<Variable, ScopeInformation, GeneratedCodeState> compiler; + private final VisitorIF<Variable> compiler; + private final CodeGraph graph; + private final boolean printResult; + private Block block; + private final Map<String, ConstantChecker<Variable>> constants; + private final Stack<BreakAction> breakStack = new Stack<BreakAction>(); + private static final Map<operatorType, ValueOperation> binaryOperators; + static { + Map<operatorType, ValueOperation> ops = new EnumMap<operatorType, ValueOperation>( + operatorType.class); + ops.put(operatorType.Add, ValueOperation.ADD); + ops.put(operatorType.Sub, ValueOperation.SUBTRACT); + ops.put(operatorType.Mult, ValueOperation.MULTIPLY); + ops.put(operatorType.Div, ValueOperation.TRUE_DIVIDE); + ops.put(operatorType.Mod, ValueOperation.MODULO); + ops.put(operatorType.Pow, ValueOperation.POWER); + ops.put(operatorType.LShift, ValueOperation.SHIFT_LEFT); + ops.put(operatorType.RShift, ValueOperation.SHIFT_RIGHT); + ops.put(operatorType.BitOr, ValueOperation.OR); + ops.put(operatorType.BitXor, ValueOperation.XOR); + ops.put(operatorType.BitAnd, ValueOperation.AND); + ops.put(operatorType.FloorDiv, ValueOperation.FLOOR_DIVIDE); + binaryOperators = Collections.unmodifiableMap(ops); + } + private static final Map<operatorType, ValueOperation> augOperators; + static { + Map<operatorType, ValueOperation> ops = new EnumMap<operatorType, ValueOperation>( + operatorType.class); + ops.put(operatorType.Add, ValueOperation.AUG_ADD); + ops.put(operatorType.Sub, ValueOperation.AUG_SUBTRACT); + ops.put(operatorType.Mult, ValueOperation.AUG_MULTIPLY); + ops.put(operatorType.Div, ValueOperation.AUG_TRUE_DIVIDE); + ops.put(operatorType.Mod, ValueOperation.AUG_MODULO); + ops.put(operatorType.Pow, ValueOperation.AUG_POWER); + ops.put(operatorType.LShift, ValueOperation.AUG_SHIFT_LEFT); + ops.put(operatorType.RShift, ValueOperation.AUG_SHIFT_RIGHT); + ops.put(operatorType.BitOr, ValueOperation.AUG_OR); + ops.put(operatorType.BitXor, ValueOperation.AUG_XOR); + ops.put(operatorType.BitAnd, ValueOperation.AUG_AND); + ops.put(operatorType.FloorDiv, ValueOperation.AUG_FLOOR_DIVIDE); + augOperators = Collections.unmodifiableMap(ops); + } + private static final Map<unaryopType, ValueOperation> unaryOperators; + static { + Map<unaryopType, ValueOperation> ops = new EnumMap<unaryopType, ValueOperation>( + unaryopType.class); + ops.put(unaryopType.Invert, ValueOperation.INVERT); + ops.put(unaryopType.Not, ValueOperation.NOT); + ops.put(unaryopType.UAdd, ValueOperation.POSITIVE); + ops.put(unaryopType.USub, ValueOperation.NEGATIVE); + unaryOperators = ops; + } + private static final Map<cmpopType, ValueOperation> comparators; + static { + Map<cmpopType, ValueOperation> ops = new EnumMap<cmpopType, ValueOperation>( + cmpopType.class); + ops.put(cmpopType.Eq, ValueOperation.EQUAL); + ops.put(cmpopType.NotEq, ValueOperation.NOT_EQUAL); + ops.put(cmpopType.Lt, ValueOperation.LESS_THAN); + ops.put(cmpopType.LtE, ValueOperation.LESS_THAN_OR_EQUAL_TO); + ops.put(cmpopType.Gt, ValueOperation.GREATER_THAN); + ops.put(cmpopType.GtE, ValueOperation.GREATER_THAN_OR_EQUAL_TO); + ops.put(cmpopType.Is, ValueOperation.IS); + ops.put(cmpopType.IsNot, ValueOperation.IS_NOT); + ops.put(cmpopType.In, ValueOperation.CONTAINED_IN); + ops.put(cmpopType.NotIn, ValueOperation.NOT_CONTAINED_IN); + comparators = Collections.unmodifiableMap(ops); + } + + /** + * @param compiler + * @param constants + * @param graph + */ + public FlowGraphGenerator(VisitorIF<Variable> compiler, + Map<String, ConstantChecker<Variable>> constants, CodeGraph graph) { + this(false, compiler, constants, graph); + } + + /** + * @param printResult + * @param compiler + * @param constants + * @param graph + */ + public FlowGraphGenerator(boolean printResult, + VisitorIF<Variable> compiler, + Map<String, ConstantChecker<Variable>> constants, CodeGraph graph) { + this.printResult = printResult; + this.compiler = compiler; + this.constants = constants; + this.graph = graph; + } + + // Handle undefined + + @Override + public void traverse(PythonTree node) throws Exception { + // Delegate to the director + node.traverse(compiler); + } + + @Override + protected Variable unhandled_node(PythonTree node) throws Exception { + throw new ParseException("Cannot generate code for " + + node.getClass().getName(), node); + } + + // Helper method + + private Variable loadClosure(ScopeInformation scope) { + java.util.List<Variable> freeVars = new LinkedList<Variable>(); + for (String free : scope.freeVariables()) { + freeVars.add(graph.getVariable(free)); + } + Variable[] closure = freeVars.toArray(new Variable[] {}); + return block.valueOperation(ValueOperation.MAKE_ARRAY, closure); + } + + private Variable loadDefaults(exprType[] defaults) throws Exception { + Variable[] vars = evalAll(defaults); + return block.valueOperation(ValueOperation.MAKE_ARRAY, vars); + } + + private Variable[] loadDecorators(exprType[] decorators) throws Exception { + Variable[] loaded = evalAll(decorators); + // reverse the result, decorators are declared and loaded top-down, + // but applied bottom-up + Variable[] result = new Variable[loaded.length]; + for (int i = 0; i < loaded.length; i--) { + result[result.length - i] = loaded[i]; + } + return result; + } + + private Variable applyDecorators(Variable target, Variable[] decorators) { + if (decorators == null || decorators.length == 0) { + return target; + } + for (Variable decorator : decorators) { + target = block.valueOperation(ValueOperation.CALL, decorator, + target); + } + return target; + } + + private Variable eval(exprType value, Variable... preserve) + throws Exception { + return value.accept(this); + } + + private Variable eval(sliceType slice, Variable... preserve) + throws Exception { + return slice.accept(this); + } + + private Variable[] evalAll(exprType... values) throws Exception { + Variable[] result = new Variable[values.length]; + for (int i = 0; i < values.length; i++) { + result[i] = eval(values[i], result); + } + return result; + } + + private void compile(stmtType... body) throws Exception { + for (stmtType stmt : body) { + stmt.accept(compiler); + } + } + + private class Assignment extends VisitorBase<Void> { + + private final Variable value; + + Assignment(Variable value) { + this.value = value; + } + + @Override + public void traverse(PythonTree node) throws Exception { + } + + @Override + protected Void unhandled_node(PythonTree node) throws Exception { + throw new IllegalArgumentException("Cannot assign to " + + node.getClass().getName()); + } + + @Override + public Void visitName(Name node) throws Exception { + block.voidOperation(VoidOperation.STORE, + graph.getVariable(node.id), value); + return null; + } + + private void tupleAssign(exprType[] elts) throws Exception { + int before = -1, after = 0; + for (exprType elt : elts) { + if (false /*elt instanceof Starred*/) { + // For 3.0 compatibility, where one can have starred targets + if (before == -1) { + before = after; + after = 0; + } else { + throw new ParseException( + "more than one starred expressions in assignment", + elt); + } + } else { + after++; + } + } + Variable unpacked; + if (before != -1) { + unpacked = block.valueOperation(ValueOperation.UNPACK, value, + graph.getConstant(before), graph.getConstant(after)); + } else { + unpacked = block.valueOperation(ValueOperation.UNPACK, value, + graph.getConstant(after)); + } + int i = 0; + if (before != -1) { + for (; i < before; i++) { + Variable value = block.valueOperation( + ValueOperation.ARRAY_GET, unpacked, + graph.getConstant(i)); + elts[i].accept(new Assignment(value)); + } + Variable value = block.valueOperation(ValueOperation.ARRAY_GET, + unpacked, graph.getConstant(i)); + elts[i++]/* TODO: cast elts[i++] to Starred */ + /* and pick out the value element */.accept(new Assignment( + value)); + } + before += 1; // either this was -1, or we consumed the extra starred + for (; i < before + after; i++) { + Variable value = block.valueOperation(ValueOperation.ARRAY_GET, + unpacked, graph.getConstant(i)); + elts[i].accept(new Assignment(value)); + } + } + + @Override + public Void visitTuple(Tuple node) throws Exception { + tupleAssign(node.elts); + return null; + } + + @Override + public Void visitList(List node) throws Exception { + tupleAssign(node.elts); + return null; + } + + @Override + public Void visitDict(Dict node) throws Exception { + // Dictionary assignment is easy enough, once the syntax supports it + for (int i = 0; i < node.keys.length; i++) { + Variable key = eval(node.keys[i]); + Variable value = block.valueOperation( + ValueOperation.LOAD_ATTRIBUTE, this.value, key); + node.values[i].accept(new Assignment(value)); + } + return null; + } + + @Override + public Void visitAttribute(Attribute node) throws Exception { + Variable target = eval(node.value); + block.voidOperation(VoidOperation.STORE_ATTRIBUTE, target, + graph.getConstant(node.attr), value); + return null; + } + + @Override + public Void visitSubscript(Subscript node) throws Exception { + Variable target = eval(node.value); + Variable slice = eval(node.slice); + block.voidOperation(VoidOperation.STORE_ITEM, target, slice, value); + return null; + } + } + + private final VisitorIF<Void> delete = new VisitorBase<Void>() { + + @Override + public void traverse(PythonTree node) throws Exception { + } + + @Override + protected Void unhandled_node(PythonTree node) throws Exception { + throw new IllegalArgumentException("Cannot delete " + + node.getClass().getName()); + } + + @Override + public Void visitName(Name node) throws Exception { + block.voidOperation(VoidOperation.DELETE, + graph.getConstant(node.id)); + return null; + } + + @Override + public Void visitAttribute(Attribute node) throws Exception { + Variable target = eval(node.value); + block.voidOperation(VoidOperation.DELETE_ATTRIBUTE, target, + graph.getConstant(node.attr)); + return null; + } + + @Override + public Void visitSubscript(Subscript node) throws Exception { + Variable target = eval(node.value); + Variable slice = eval(node.slice); + block.voidOperation(VoidOperation.DELETE_ITEM, target, slice); + return null; + } + }; + + // -- Entry points -- + + // Class + + public GeneratedCodeState beforeClassDef(ClassDef node, + ScopeInformation scope) throws Exception { + Variable name = graph.getConstant(node.name); + Variable[] baseVars; + if (node.bases != null) { + baseVars = new Variable[node.bases.length]; + int i = 0; + for (exprType base : node.bases) { + baseVars[i] = base.accept(this); + } + } else { + baseVars = new Variable[0]; + } + Variable bases = block.valueOperation(ValueOperation.MAKE_ARRAY, + baseVars); + return new GeneratedCodeState(name, bases, loadClosure(scope), + new Variable[] {}); + } + + @Override + public Variable visitClassDef(ClassDef node) throws Exception { + block = graph.entryBlock(); + for (stmtType stmt : node.body) { + stmt.accept(compiler); + } + return graph.handle(); + } + + public void afterClassDef(ClassDef node, GeneratedCodeState state, + Variable result) throws Exception { + Variable dict = block.valueOperation(ValueOperation.CALL_CODE, result, + state.classClosure()); + Variable klass = block.valueOperation(ValueOperation.DEFINE_CLASS, + state.name(), state.classBases(), dict); + klass = applyDecorators(klass, state.decorators()); + block.voidOperation(VoidOperation.STORE, state.name(), klass); + } + + // Function + + public GeneratedCodeState beforeFunctionDef(FunctionDef node, + ScopeInformation scope) throws Exception { + Variable name = graph.getConstant(node.name); + Variable[] decorators = loadDecorators(node.decorators); + return new GeneratedCodeState(name, loadClosure(scope), + loadDefaults(node.args.defaults), decorators); + } + + @Override + public Variable visitFunctionDef(FunctionDef node) throws Exception { + block = graph.entryBlock(); + for (stmtType stmt : node.body) { + stmt.accept(compiler); + } + return graph.handle(); + } + + public void afterFunctionDef(FunctionDef node, GeneratedCodeState state, + Variable result) throws Exception { + Variable function = block.valueOperation(ValueOperation.MAKE_FUNCTION, + result, state.funcClosure(), state.funcDefaults()); + function = applyDecorators(function, state.decorators()); + block.voidOperation(VoidOperation.STORE, state.name(), function); + } + + // Lambda + + public GeneratedCodeState beforeLambda(Lambda node, ScopeInformation scope) + throws Exception { + return new GeneratedCodeState(null, loadClosure(scope), + loadDefaults(node.args.defaults)); + } + + @Override + public Variable visitLambda(Lambda node) throws Exception { + block = graph.entryBlock(); + block.returnOperation(node.body.accept(compiler)); + return graph.handle(); + } + + public Variable afterLambda(Lambda node, GeneratedCodeState state, + Variable result) throws Exception { + return block.valueOperation(ValueOperation.MAKE_FUNCTION, result, + state.funcClosure(), state.funcDefaults()); + } + + // Generator + + public GeneratedCodeState beforeGeneratorExp(GeneratorExp node, + ScopeInformation scope) throws Exception { + Variable startArg = eval(node.generators[0].iter); + startArg = block.valueOperation(ValueOperation.GET_ITERATOR, startArg); + return new GeneratedCodeState(null, loadClosure(scope), startArg); + } + + @Override + public Variable visitGeneratorExp(GeneratorExp node) throws Exception { + block = graph.entryBlock(); + Variable iter = block.valueOperation(ValueOperation.LOAD, + graph.getArgument(0)); + unrollComprehension(node.elt, node.generators, block, iter, + graph.exitBlock(), new ComprehensionAction() { + @Override + Link perform(Variable var, Block current, Block next, + Variable... variables) { + return current.yieldOperation(var, next, variables); + } + }); + return graph.handle(); + } + + public Variable afterGeneratorExp(GeneratorExp node, + GeneratedCodeState state, Variable result) throws Exception { + return block.valueOperation(ValueOperation.CALL_CODE, result, + state.funcClosure(), state.generatorStartArg()); + } + + // Suite + + @Override + public Variable visitSuite(Suite node) throws Exception { + throw new ParseException("Cannot compile Suite without context.", node); + } + + // Loops + + private static abstract class ComprehensionAction { + /** + * @param var The variable that was the result of the comprehension + * expression. + * @param current The block where we enter. + * @param next The block we are supposed to continue to. + * @param variables The variables that should be carried onto the next + * block. + * @return the link from the current block to the next. + */ + abstract Link perform(Variable var, Block current, Block next, + Variable... variables); + } + + // FIXME: this is not completed... take inspiration from visitFor + private void unrollComprehension(exprType elt, + comprehensionType[] generators, Block start, Variable iter, + Block end, ComprehensionAction action) throws Exception { + Link fail = start.nextBlock(graph.exitBlock(), graph.None()); + Variable[] iterators = null; + for (comprehensionType comprehension : generators) { + if (iterators == null) { + iterators = new Variable[] { iter }; + } else { + Variable[] newIterators = new Variable[iterators.length + 1]; + System.arraycopy(iterators, 0, iterators, 0, iterators.length); + iterators = newIterators; + Variable iterVar = eval(comprehension.iter); + iter = block.valueOperation(ValueOperation.GET_ITERATOR, + iterVar); + iterators[iterators.length - 1] = iter; + } + block.iterNext(iter, fail, block = graph.newBlock(), iterators); + if (comprehension.ifs != null && comprehension.ifs.length != 0) { + for (exprType condition : comprehension.ifs) { + + } + } + } + } + + public Variable visitFor(For node) throws Exception { + LinkGroup loop = graph.newLoop(); + Variable iterator = eval(node.iter); + Variable iter = block.valueOperation(ValueOperation.GET_ITERATOR, + iterator); + Block head = newBlock(block, iter); + Block orelse; + Block done = newBlock(block); + if (node.orelse != null) { + orelse = newBlock(block); + } else { + orelse = done; + } + Block body = newBlock(block, iter); + Link entry = block.nextBlock(head, iter); + Link on_exhausted = head.nextBlock(orelse); + Link on_hasnext = head.iterNext(iter, on_exhausted, body, + new Variable[] {}); + // TODO: this should be the other way around, by utilizing SuperBlocks + loop.add(entry); + loop.add(on_exhausted); + loop.add(on_hasnext); + block = body; + breakStack.push(new BreakAction(loop, done, head)); + compile(node.body); + if (node.orelse != null) { + block = orelse; + compile(node.orelse); + } + block = done; + return null; + } + + private Block newBlock(Block template, Variable... variables) { + // TODO Auto-generated method stub + return null; + } + + public Variable visitWhile(While node) throws Exception { + // TODO Auto-generated method stub + return null; + } + + public Variable visitBreak(Break node) throws Exception { + // TODO Auto-generated method stub + return null; + } + + public Variable visitContinue(Continue node) throws Exception { + // TODO Auto-generated method stub + return null; + } + + @Override + public Variable visitListComp(ListComp node) throws Exception { + final Variable list = block.valueOperation(ValueOperation.MAKE_LIST); + Variable iterVal = eval(node.generators[0].iter); + Variable iter = block.valueOperation(ValueOperation.GET_ITERATOR, + iterVal); + Block after = graph.newBlock(); + unrollComprehension(node.elt, node.generators, block, iter, after, + new ComprehensionAction() { + @Override + Link perform(Variable var, Block location, Block next, + Variable... variables) { + location.voidOperation(VoidOperation.LIST_APPEND, list, + var); + return location.nextBlock(next, variables); + } + }); + block = after; + return list; + } + + // Selection + + public Variable visitIf(If node) throws Exception { + // TODO Auto-generated method stub + return null; + } + + public Variable visitIfExp(IfExp node) throws Exception { + // TODO Auto-generated method stub + return null; + } + + public Variable visitBoolOp(BoolOp node) throws Exception { + switch (node.op) { + case And: + // TODO + break; + case Or: + // TODO + break; + default: + throw new ParseException("Unknown boolean operation " + + node.op.name(), node); + } + return null; + } + + public Variable visitCompare(Compare node) throws Exception { + if (node.comparators.length == 1) { + Variable left = eval(node.left); + Variable comparator = eval(node.comparators[0]); + return block.valueOperation(comparators.get(node.ops[0]), left, + comparator); + } + // TODO Auto-generated method stub + return null; + } + + // Assignment + + @Override + public Variable visitAssign(Assign node) throws Exception { + Variable value = eval(node.value); + for (exprType target : node.targets) { + target.accept(new Assignment(value)); + } + return null; + } + + @Override + public Variable visitAugAssign(AugAssign node) throws Exception { + Variable target = eval(node.target); + Variable rhs = eval(node.value); + Variable value = block.valueOperation(augOperators.get(node.op), + target, rhs); + node.target.accept(new Assignment(value)); + return null; + } + + // Deletion + + @Override + public Variable visitDelete(Delete node) throws Exception { + node.traverse(delete); + return null; + } + + // Call + + @Override + public Variable visitCall(Call node) throws Exception { + Variable func = eval(node.func); + ... [truncated message content] |
From: <th...@us...> - 2008-09-01 14:34:02
|
Revision: 5280 http://jython.svn.sourceforge.net/jython/?rev=5280&view=rev Author: thobes Date: 2008-09-01 14:33:42 +0000 (Mon, 01 Sep 2008) Log Message: ----------- Manually performing the merge I would have liked svnmerge to do. However I could not figure out how get the merge right. The problem was that the advanced branch is a branch from a branch (asm), and that the branch has been merged into trunk. I wanted to merge in changes that had occured both in the asm branch and in trunk so that I could merge from trunk in the future. This was simply too many circular merges for svnmerge to handle. Anyhow the merge in this commit brings the advanced branch up to the state where the asm branch was merged into trunk. The branch pointer has also been redirected to point to trunk so that svnmerge will work for future merges. Modified Paths: -------------- branches/advanced/.classpath branches/advanced/CPythonLib.includes branches/advanced/CoreExposed.includes branches/advanced/Lib/codeop.py branches/advanced/Lib/datetime.py branches/advanced/Lib/distutils/ccompiler.py branches/advanced/Lib/distutils/command/bdist.py branches/advanced/Lib/distutils/command/bdist_dumb.py branches/advanced/Lib/distutils/command/install.py branches/advanced/Lib/distutils/command/sdist.py branches/advanced/Lib/distutils/file_util.py branches/advanced/Lib/distutils/spawn.py branches/advanced/Lib/distutils/sysconfig.py branches/advanced/Lib/distutils/util.py branches/advanced/Lib/ntpath.py branches/advanced/Lib/os.py branches/advanced/Lib/posixpath.py branches/advanced/Lib/random.py branches/advanced/Lib/site.py branches/advanced/Lib/socket.py branches/advanced/Lib/subprocess.py branches/advanced/Lib/test/list_tests.py branches/advanced/Lib/test/regrtest.py branches/advanced/Lib/test/test__rawffi.py branches/advanced/Lib/test/test_array_jy.py branches/advanced/Lib/test/test_ast.py branches/advanced/Lib/test/test_builtin.py branches/advanced/Lib/test/test_cmd_line.py branches/advanced/Lib/test/test_deque.py branches/advanced/Lib/test/test_descr_jy.py branches/advanced/Lib/test/test_descrtut.py branches/advanced/Lib/test/test_dict_jy.py branches/advanced/Lib/test/test_exceptions_jy.py branches/advanced/Lib/test/test_file_newlines.py branches/advanced/Lib/test/test_float_jy.py branches/advanced/Lib/test/test_format.py branches/advanced/Lib/test/test_functools.py branches/advanced/Lib/test/test_grammar_jy.py branches/advanced/Lib/test/test_importhooks.py branches/advanced/Lib/test/test_inspect.py branches/advanced/Lib/test/test_java_integration.py branches/advanced/Lib/test/test_javashell.py branches/advanced/Lib/test/test_jreload.py branches/advanced/Lib/test/test_jser2.py branches/advanced/Lib/test/test_jy_internals.py branches/advanced/Lib/test/test_re_jy.py branches/advanced/Lib/test/test_select.py branches/advanced/Lib/test/test_select_new.py branches/advanced/Lib/test/test_slots_jy.py branches/advanced/Lib/test/test_socket.py branches/advanced/Lib/test/test_subclasses.py branches/advanced/Lib/test/test_support.py branches/advanced/Lib/test/test_sys_jy.py branches/advanced/Lib/test/test_traceback.py branches/advanced/Lib/threading.py branches/advanced/Misc/make_binops.py branches/advanced/NEWS branches/advanced/README.txt branches/advanced/ast/asdl_antlr.py branches/advanced/ast/astdump.py branches/advanced/build.xml branches/advanced/compiler/org/python/compiler/AdvancedCompiler.java branches/advanced/extlibs/jna-posix.jar branches/advanced/grammar/Python.g branches/advanced/grammar/PythonPartial.g branches/advanced/grammar/PythonWalker.g branches/advanced/src/com/ziclix/python/sql/DataHandler.java branches/advanced/src/com/ziclix/python/sql/Fetch.java branches/advanced/src/com/ziclix/python/sql/PyConnection.java branches/advanced/src/com/ziclix/python/sql/PyCursor.java branches/advanced/src/com/ziclix/python/sql/PyExtendedCursor.java branches/advanced/src/com/ziclix/python/sql/PyStatement.java branches/advanced/src/com/ziclix/python/sql/connect/Connect.java branches/advanced/src/com/ziclix/python/sql/connect/Connectx.java branches/advanced/src/com/ziclix/python/sql/connect/Lookup.java branches/advanced/src/com/ziclix/python/sql/util/BCP.java branches/advanced/src/org/python/antlr/ExpressionParser.java branches/advanced/src/org/python/antlr/InteractiveParser.java branches/advanced/src/org/python/antlr/ModuleParser.java branches/advanced/src/org/python/antlr/ParseException.java branches/advanced/src/org/python/antlr/PythonTokenSource.java branches/advanced/src/org/python/antlr/PythonTree.java branches/advanced/src/org/python/antlr/PythonTreeAdaptor.java branches/advanced/src/org/python/antlr/ast/Assert.java branches/advanced/src/org/python/antlr/ast/Assign.java branches/advanced/src/org/python/antlr/ast/Attribute.java branches/advanced/src/org/python/antlr/ast/AugAssign.java branches/advanced/src/org/python/antlr/ast/BinOp.java branches/advanced/src/org/python/antlr/ast/BoolOp.java branches/advanced/src/org/python/antlr/ast/Break.java branches/advanced/src/org/python/antlr/ast/Call.java branches/advanced/src/org/python/antlr/ast/ClassDef.java branches/advanced/src/org/python/antlr/ast/Compare.java branches/advanced/src/org/python/antlr/ast/Continue.java branches/advanced/src/org/python/antlr/ast/Delete.java branches/advanced/src/org/python/antlr/ast/Dict.java branches/advanced/src/org/python/antlr/ast/Ellipsis.java branches/advanced/src/org/python/antlr/ast/Exec.java branches/advanced/src/org/python/antlr/ast/Expr.java branches/advanced/src/org/python/antlr/ast/Expression.java branches/advanced/src/org/python/antlr/ast/ExtSlice.java branches/advanced/src/org/python/antlr/ast/For.java branches/advanced/src/org/python/antlr/ast/FunctionDef.java branches/advanced/src/org/python/antlr/ast/GeneratorExp.java branches/advanced/src/org/python/antlr/ast/Global.java branches/advanced/src/org/python/antlr/ast/If.java branches/advanced/src/org/python/antlr/ast/IfExp.java branches/advanced/src/org/python/antlr/ast/Import.java branches/advanced/src/org/python/antlr/ast/ImportFrom.java branches/advanced/src/org/python/antlr/ast/Index.java branches/advanced/src/org/python/antlr/ast/Interactive.java branches/advanced/src/org/python/antlr/ast/Lambda.java branches/advanced/src/org/python/antlr/ast/List.java branches/advanced/src/org/python/antlr/ast/ListComp.java branches/advanced/src/org/python/antlr/ast/Module.java branches/advanced/src/org/python/antlr/ast/Name.java branches/advanced/src/org/python/antlr/ast/Num.java branches/advanced/src/org/python/antlr/ast/Pass.java branches/advanced/src/org/python/antlr/ast/Print.java branches/advanced/src/org/python/antlr/ast/Raise.java branches/advanced/src/org/python/antlr/ast/Repr.java branches/advanced/src/org/python/antlr/ast/Return.java branches/advanced/src/org/python/antlr/ast/Slice.java branches/advanced/src/org/python/antlr/ast/Str.java branches/advanced/src/org/python/antlr/ast/Subscript.java branches/advanced/src/org/python/antlr/ast/Suite.java branches/advanced/src/org/python/antlr/ast/TryExcept.java branches/advanced/src/org/python/antlr/ast/TryFinally.java branches/advanced/src/org/python/antlr/ast/Tuple.java branches/advanced/src/org/python/antlr/ast/UnaryOp.java branches/advanced/src/org/python/antlr/ast/Unicode.java branches/advanced/src/org/python/antlr/ast/While.java branches/advanced/src/org/python/antlr/ast/With.java branches/advanced/src/org/python/antlr/ast/Yield.java branches/advanced/src/org/python/antlr/ast/aliasType.java branches/advanced/src/org/python/antlr/ast/argumentsType.java branches/advanced/src/org/python/antlr/ast/comprehensionType.java branches/advanced/src/org/python/antlr/ast/excepthandlerType.java branches/advanced/src/org/python/antlr/ast/keywordType.java branches/advanced/src/org/python/compiler/APIVersion.java branches/advanced/src/org/python/compiler/ClassFile.java branches/advanced/src/org/python/compiler/Code.java branches/advanced/src/org/python/compiler/CodeCompiler.java branches/advanced/src/org/python/compiler/Module.java branches/advanced/src/org/python/compiler/ScopeInfo.java branches/advanced/src/org/python/compiler/ScopesCompiler.java branches/advanced/src/org/python/core/AbstractArray.java branches/advanced/src/org/python/core/ArgParser.java branches/advanced/src/org/python/core/CompilerFacade.java branches/advanced/src/org/python/core/CompilerFlags.java branches/advanced/src/org/python/core/FunctionThread.java branches/advanced/src/org/python/core/ParserFacade.java branches/advanced/src/org/python/core/Py.java branches/advanced/src/org/python/core/PyArray.java branches/advanced/src/org/python/core/PyArrayDerived.java branches/advanced/src/org/python/core/PyBaseException.java branches/advanced/src/org/python/core/PyBaseExceptionDerived.java branches/advanced/src/org/python/core/PyBooleanDerived.java branches/advanced/src/org/python/core/PyClass.java branches/advanced/src/org/python/core/PyClassMethodDerived.java branches/advanced/src/org/python/core/PyComplex.java branches/advanced/src/org/python/core/PyComplexDerived.java branches/advanced/src/org/python/core/PyDictionaryDerived.java branches/advanced/src/org/python/core/PyEnumerateDerived.java branches/advanced/src/org/python/core/PyFileDerived.java branches/advanced/src/org/python/core/PyFloat.java branches/advanced/src/org/python/core/PyFloatDerived.java branches/advanced/src/org/python/core/PyFrame.java branches/advanced/src/org/python/core/PyFrozenSetDerived.java branches/advanced/src/org/python/core/PyGenerator.java branches/advanced/src/org/python/core/PyInstance.java branches/advanced/src/org/python/core/PyInteger.java branches/advanced/src/org/python/core/PyIntegerDerived.java branches/advanced/src/org/python/core/PyJavaClass.java branches/advanced/src/org/python/core/PyJavaPackage.java branches/advanced/src/org/python/core/PyList.java branches/advanced/src/org/python/core/PyListDerived.java branches/advanced/src/org/python/core/PyLong.java branches/advanced/src/org/python/core/PyLongDerived.java branches/advanced/src/org/python/core/PyMethod.java branches/advanced/src/org/python/core/PyModule.java branches/advanced/src/org/python/core/PyModuleDerived.java branches/advanced/src/org/python/core/PyObject.java branches/advanced/src/org/python/core/PyObjectDerived.java branches/advanced/src/org/python/core/PyPropertyDerived.java branches/advanced/src/org/python/core/PySequence.java branches/advanced/src/org/python/core/PySequenceIter.java branches/advanced/src/org/python/core/PySetDerived.java branches/advanced/src/org/python/core/PySlice.java branches/advanced/src/org/python/core/PySliceDerived.java branches/advanced/src/org/python/core/PyString.java branches/advanced/src/org/python/core/PyStringDerived.java branches/advanced/src/org/python/core/PySuper.java branches/advanced/src/org/python/core/PySuperDerived.java branches/advanced/src/org/python/core/PySyntaxError.java branches/advanced/src/org/python/core/PySystemState.java branches/advanced/src/org/python/core/PyTableCode.java branches/advanced/src/org/python/core/PyTraceback.java branches/advanced/src/org/python/core/PyTuple.java branches/advanced/src/org/python/core/PyTupleDerived.java branches/advanced/src/org/python/core/PyType.java branches/advanced/src/org/python/core/PyTypeDerived.java branches/advanced/src/org/python/core/PyUnicode.java branches/advanced/src/org/python/core/PyUnicodeDerived.java branches/advanced/src/org/python/core/StdoutWrapper.java branches/advanced/src/org/python/core/ThreadState.java branches/advanced/src/org/python/core/__builtin__.java branches/advanced/src/org/python/core/imp.java branches/advanced/src/org/python/core/io/FileIO.java branches/advanced/src/org/python/core/io/TextIOBase.java branches/advanced/src/org/python/modules/ArrayModule.java branches/advanced/src/org/python/modules/Setup.java branches/advanced/src/org/python/modules/_codecs.java branches/advanced/src/org/python/modules/_weakref/ProxyType.java branches/advanced/src/org/python/modules/_weakref/ReferenceTypeDerived.java branches/advanced/src/org/python/modules/cPickle.java branches/advanced/src/org/python/modules/cStringIO.java branches/advanced/src/org/python/modules/collections/PyDefaultDictDerived.java branches/advanced/src/org/python/modules/collections/PyDeque.java branches/advanced/src/org/python/modules/collections/PyDequeDerived.java branches/advanced/src/org/python/modules/imp.java branches/advanced/src/org/python/modules/operator.java branches/advanced/src/org/python/modules/random/PyRandomDerived.java branches/advanced/src/org/python/modules/sre/MatchObject.java branches/advanced/src/org/python/modules/sre/PatternObject.java branches/advanced/src/org/python/modules/struct.java branches/advanced/src/org/python/modules/thread/PyLocalDerived.java branches/advanced/src/org/python/modules/thread/thread.java branches/advanced/src/org/python/modules/zipimport/zipimporter.java branches/advanced/src/org/python/modules/zipimport/zipimporterDerived.java branches/advanced/src/org/python/util/InteractiveInterpreter.java branches/advanced/src/org/python/util/PythonInterpreter.java branches/advanced/src/org/python/util/jython.java branches/advanced/src/shell/jython branches/advanced/src/templates/mappings branches/advanced/src/templates/object.derived Added Paths: ----------- branches/advanced/Lib/decimal.py branches/advanced/Lib/distutils/tests/ branches/advanced/Lib/distutils/tests/test_build_py.py branches/advanced/Lib/grp.py branches/advanced/Lib/pkgutil.py branches/advanced/Lib/pwd.py branches/advanced/Lib/test/bad_coding2.py branches/advanced/Lib/test/test_array.py branches/advanced/Lib/test/test_class.py branches/advanced/Lib/test/test_cmp_jy.py branches/advanced/Lib/test/test_codeop.py branches/advanced/Lib/test/test_compile.py branches/advanced/Lib/test/test_cpickle_jy.py branches/advanced/Lib/test/test_generators.py branches/advanced/Lib/test/test_genexps.py branches/advanced/Lib/test/test_iter_jy.py branches/advanced/Lib/test/test_operator.py branches/advanced/Lib/test/test_pkgimport.py branches/advanced/Lib/test/test_subprocess_jy.py branches/advanced/Lib/test/test_syntax.py branches/advanced/Lib/test/test_tuple.py branches/advanced/extlibs/antlr-3.1.jar branches/advanced/extlibs/antlr-runtime-3.1.jar branches/advanced/extlibs/stringtemplate-3.2.jar branches/advanced/src/com/ziclix/python/sql/Jython22DataHandler.java branches/advanced/src/org/python/antlr/BaseParser.java branches/advanced/src/org/python/antlr/ErrorHandler.java branches/advanced/src/org/python/antlr/FailFastHandler.java branches/advanced/src/org/python/antlr/GrammarActions.java branches/advanced/src/org/python/antlr/ListErrorHandler.java branches/advanced/src/org/python/antlr/PythonErrorNode.java branches/advanced/src/org/python/antlr/ast/ErrorExpr.java branches/advanced/src/org/python/antlr/ast/ErrorMod.java branches/advanced/src/org/python/antlr/ast/ErrorSlice.java branches/advanced/src/org/python/antlr/ast/ErrorStmt.java branches/advanced/src/org/python/core/APIReader.java branches/advanced/src/org/python/core/PyFastSequenceIter.java branches/advanced/src/org/python/core/PyIndentationError.java branches/advanced/src/org/python/core/io/TextIOInputStream.java branches/advanced/src/org/python/modules/_csv/ branches/advanced/src/org/python/modules/_csv/PyDialect.java branches/advanced/src/org/python/modules/_csv/PyDialectDerived.java branches/advanced/src/org/python/modules/_csv/PyReader.java branches/advanced/src/org/python/modules/_csv/PyWriter.java branches/advanced/src/org/python/modules/_csv/QuoteStyle.java branches/advanced/src/org/python/modules/_csv/_csv.java branches/advanced/src/org/python/modules/_functools/ branches/advanced/src/org/python/modules/_functools/PyPartial.java branches/advanced/src/org/python/modules/_functools/PyPartialDerived.java branches/advanced/src/org/python/modules/_functools/_functools.java branches/advanced/src/org/python/modules/_systemrestart.java branches/advanced/src/shell/jython.bat branches/advanced/src/templates/dialect.derived branches/advanced/src/templates/partial.derived branches/advanced/tests/java/org/python/antlr/ branches/advanced/tests/java/org/python/antlr/GrammarTester.java branches/advanced/tests/java/org/python/antlr/PythonPartialTester.java branches/advanced/tests/java/org/python/antlr/PythonTreeTester.java branches/advanced/tests/java/org/python/antlr/WalkerTester.java Removed Paths: ------------- branches/advanced/Lib/UserList.py branches/advanced/Lib/distutils/tests/test_build_py.py branches/advanced/Lib/functools.py branches/advanced/Lib/test/output/test_array_jy branches/advanced/Lib/test/output/test_re branches/advanced/Lib/test/seq_tests.py branches/advanced/Lib/test/test_userlist.py branches/advanced/extlibs/antlr-3.1b1.jar branches/advanced/extlibs/antlr-runtime-3.1b1.jar branches/advanced/extlibs/stringtemplate-3.1b1.jar branches/advanced/src/org/python/antlr/GrammarTester.java branches/advanced/src/org/python/antlr/IParserHost.java branches/advanced/src/org/python/antlr/ImaginaryToken.java branches/advanced/src/org/python/antlr/LeadingSpaceSkippingStream.java branches/advanced/src/org/python/antlr/PythonPartialTester.java branches/advanced/src/org/python/antlr/PythonPartialTokenSource.java branches/advanced/src/org/python/antlr/PythonTreeTester.java branches/advanced/src/org/python/antlr/WalkerTester.java branches/advanced/src/org/python/modules/_csv/PyDialect.java branches/advanced/src/org/python/modules/_csv/PyDialectDerived.java branches/advanced/src/org/python/modules/_csv/PyReader.java branches/advanced/src/org/python/modules/_csv/PyWriter.java branches/advanced/src/org/python/modules/_csv/QuoteStyle.java branches/advanced/src/org/python/modules/_csv/_csv.java branches/advanced/src/org/python/modules/_functools/PyPartial.java branches/advanced/src/org/python/modules/_functools/PyPartialDerived.java branches/advanced/src/org/python/modules/_functools/_functools.java branches/advanced/src/org/python/modules/xreadlines.java branches/advanced/tests/java/org/python/antlr/GrammarTester.java branches/advanced/tests/java/org/python/antlr/PythonPartialTester.java branches/advanced/tests/java/org/python/antlr/PythonTreeTester.java branches/advanced/tests/java/org/python/antlr/WalkerTester.java Property Changed: ---------------- branches/advanced/ Property changes on: branches/advanced ___________________________________________________________________ Modified: svnmerge-integrated - /branches/asm:1-4928 /trunk/jython:1-4899 + /trunk/jython:1-5210 Modified: branches/advanced/.classpath =================================================================== --- branches/advanced/.classpath 2008-09-01 06:32:39 UTC (rev 5279) +++ branches/advanced/.classpath 2008-09-01 14:33:42 UTC (rev 5280) @@ -19,6 +19,6 @@ <classpathentry kind="lib" path="extlibs/servlet-api-2.5.jar"/> <classpathentry kind="lib" path="build/jarjar"/> <classpathentry kind="var" path="Ant"/> - <classpathentry kind="lib" path="extlibs/antlr-3.1b1.jar"/> + <classpathentry kind="lib" path="extlibs/antlr-runtime-3.1.jar"/> <classpathentry kind="output" path="bugtests/classes"/> </classpath> Modified: branches/advanced/CPythonLib.includes =================================================================== --- branches/advanced/CPythonLib.includes 2008-09-01 06:32:39 UTC (rev 5279) +++ branches/advanced/CPythonLib.includes 2008-09-01 14:33:42 UTC (rev 5280) @@ -43,11 +43,12 @@ copy.py copy_reg.py Cookie.py -decimal.py +csv.py difflib.py dircache.py dircmp.py dis.py +DocXMLRPCServer.py dospath.py dumbdbm.py exceptions.py @@ -57,6 +58,7 @@ formatter.py fpformat.py ftplib.py +functools.py getopt.py gettext.py glob.py @@ -69,6 +71,7 @@ htmllib.py HTMLParser.py httplib.py +ihooks.py imaplib.py imghdr.py inspect.py @@ -116,6 +119,7 @@ repr.py rfc822.py rlcompleter.py +robotparser.py runpy.py sched.py sha.py @@ -136,6 +140,7 @@ string.py StringIO.py symbol.py +tabnanny.py this.py threading.py textwrap.py @@ -151,6 +156,7 @@ urlparse.py user.py UserDict.py +UserList.py UserString.py uu.py uuid.py Modified: branches/advanced/CoreExposed.includes =================================================================== --- branches/advanced/CoreExposed.includes 2008-09-01 06:32:39 UTC (rev 5279) +++ branches/advanced/CoreExposed.includes 2008-09-01 14:33:42 UTC (rev 5280) @@ -35,6 +35,11 @@ org/python/core/PyType.class org/python/core/PyUnicode.class org/python/core/PyXRange.class +org/python/modules/_codecs$EncodingMap.class +org/python/modules/_csv/PyDialect.class +org/python/modules/_csv/PyReader.class +org/python/modules/_csv/PyWriter.class +org/python/modules/_functools/PyPartial.class org/python/modules/_weakref/CallableProxyType.class org/python/modules/_weakref/ReferenceType.class org/python/modules/_weakref/ProxyType.class Deleted: branches/advanced/Lib/UserList.py =================================================================== --- branches/advanced/Lib/UserList.py 2008-09-01 06:32:39 UTC (rev 5279) +++ branches/advanced/Lib/UserList.py 2008-09-01 14:33:42 UTC (rev 5280) @@ -1,94 +0,0 @@ -"""A more or less complete user-defined wrapper around list objects.""" - -#Imported from Python 2.3.5 and added _fixindex -class UserList: - def __init__(self, initlist=None): - self.data = [] - if initlist is not None: - # XXX should this accept an arbitrary sequence? - if type(initlist) == type(self.data): - self.data[:] = initlist - elif isinstance(initlist, UserList): - self.data[:] = initlist.data[:] - else: - self.data = list(initlist) - def __repr__(self): return repr(self.data) - def __lt__(self, other): return self.data < self.__cast(other) - def __le__(self, other): return self.data <= self.__cast(other) - def __eq__(self, other): return self.data == self.__cast(other) - def __ne__(self, other): return self.data != self.__cast(other) - def __gt__(self, other): return self.data > self.__cast(other) - def __ge__(self, other): return self.data >= self.__cast(other) - def __cast(self, other): - if isinstance(other, UserList): return other.data - else: return other - def __cmp__(self, other): - return cmp(self.data, self.__cast(other)) - def __contains__(self, item): return item in self.data - def __len__(self): return len(self.data) - def __getitem__(self, i): return self.data[i] - def __setitem__(self, i, item): self.data[i] = item - def __delitem__(self, i): del self.data[i] - def __getslice__(self, i, j): - i = self._fixindex(i); j = self._fixindex(j) - return self.__class__(self.data[i:j]) - def __setslice__(self, i, j, other): - i = self._fixindex(i); j = self._fixindex(j) - if isinstance(other, UserList): - self.data[i:j] = other.data - elif isinstance(other, type(self.data)): - self.data[i:j] = other - else: - self.data[i:j] = list(other) - def __delslice__(self, i, j): - i = self._fixindex(i); j = self._fixindex(j) - del self.data[i:j] - def __add__(self, other): - if isinstance(other, UserList): - return self.__class__(self.data + other.data) - elif isinstance(other, type(self.data)): - return self.__class__(self.data + other) - else: - return self.__class__(self.data + list(other)) - def __radd__(self, other): - if isinstance(other, UserList): - return self.__class__(other.data + self.data) - elif isinstance(other, type(self.data)): - return self.__class__(other + self.data) - else: - return self.__class__(list(other) + self.data) - def __iadd__(self, other): - if isinstance(other, UserList): - self.data += other.data - elif isinstance(other, type(self.data)): - self.data += other - else: - self.data += list(other) - return self - def __mul__(self, n): - return self.__class__(self.data*n) - __rmul__ = __mul__ - def __imul__(self, n): - self.data *= n - return self - def append(self, item): self.data.append(item) - def insert(self, i, item): self.data.insert(i, item) - def pop(self, i=-1): return self.data.pop(i) - def remove(self, item): self.data.remove(item) - def count(self, item): return self.data.count(item) - def index(self, item, *args): return self.data.index(item, *args) - def reverse(self): self.data.reverse() - def sort(self, *args): self.data.sort(*args) - def extend(self, other): - if isinstance(other, UserList): - self.data.extend(other.data) - else: - self.data.extend(other) - def _fixindex(self, index): - if index < 0: - index += len(self.data) - elif index > len(self.data): - index = len(self.data) - index = max(index, 0) - return index - Modified: branches/advanced/Lib/codeop.py =================================================================== --- branches/advanced/Lib/codeop.py 2008-09-01 06:32:39 UTC (rev 5279) +++ branches/advanced/Lib/codeop.py 2008-09-01 14:33:42 UTC (rev 5280) @@ -58,6 +58,7 @@ # import internals, not guaranteed interface from org.python.core import Py,CompilerFlags +from org.python.core.CompilerFlags import PyCF_DONT_IMPLY_DEDENT # public interface Modified: branches/advanced/Lib/datetime.py =================================================================== --- branches/advanced/Lib/datetime.py 2008-09-01 06:32:39 UTC (rev 5279) +++ branches/advanced/Lib/datetime.py 2008-09-01 14:33:42 UTC (rev 5280) @@ -981,6 +981,24 @@ def __reduce__(self): return (self.__class__, self.__getstate()) + def __tojava__(self, java_class): + from java.lang import Object + from java.sql import Date + from java.util import Calendar + from org.python.core import Py + + if java_class not in (Calendar, Date, Object): + return Py.NoConversion + + calendar = Calendar.getInstance() + calendar.clear() + calendar.set(self.year, self.month - 1, self.day) + if java_class == Calendar: + return calendar + else: + return Date(calendar.getTimeInMillis()) + + _date_class = date # so functions w/ args named "date" can get at the class date.min = date(1, 1, 1) @@ -1346,6 +1364,28 @@ def __reduce__(self): return (time, self.__getstate()) + def __tojava__(self, java_class): + # TODO, if self.tzinfo is not None, convert time to UTC + from java.lang import Object + from java.sql import Time + from java.util import Calendar + from org.python.core import Py + + if java_class not in (Calendar, Time, Object): + return Py.NoConversion + + calendar = Calendar.getInstance() + calendar.clear() + calendar.set(Calendar.HOUR_OF_DAY, self.hour) + calendar.set(Calendar.MINUTE, self.minute) + calendar.set(Calendar.SECOND, self.second) + calendar.set(Calendar.MILLISECOND, self.microsecond // 1000) + if java_class == Calendar: + return calendar + else: + return Time(calendar.getTimeInMillis()) + + _time_class = time # so functions w/ args named "time" can get at the class time.min = time(0, 0, 0) @@ -1799,7 +1839,28 @@ def __reduce__(self): return (self.__class__, self.__getstate()) + def __tojava__(self, java_class): + # TODO, if self.tzinfo is not None, convert time to UTC + from java.lang import Object + from java.sql import Timestamp + from java.util import Calendar + from org.python.core import Py + if java_class not in (Calendar, Timestamp, Object): + return Py.NoConversion + + calendar = Calendar.getInstance() + calendar.clear() + calendar.set(self.year, self.month - 1, self.day, + self.hour, self.minute, self.second) + calendar.set(Calendar.MILLISECOND, self.microsecond // 1000) + + if java_class == Calendar: + return calendar + else: + return Timestamp(calendar.getTimeInMillis()) + + datetime.min = datetime(1, 1, 1) datetime.max = datetime(9999, 12, 31, 23, 59, 59, 999999) datetime.resolution = timedelta(microseconds=1) Copied: branches/advanced/Lib/decimal.py (from rev 4988, branches/asm/Lib/decimal.py) =================================================================== --- branches/advanced/Lib/decimal.py (rev 0) +++ branches/advanced/Lib/decimal.py 2008-09-01 14:33:42 UTC (rev 5280) @@ -0,0 +1,5173 @@ +# Copyright (c) 2004 Python Software Foundation. +# All rights reserved. + +# Written by Eric Price <eprice at tjhsst.edu> +# and Facundo Batista <facundo at taniquetil.com.ar> +# and Raymond Hettinger <python at rcn.com> +# and Aahz <aahz at pobox.com> +# and Tim Peters + +# This module is currently Py2.3 compatible and should be kept that way +# unless a major compelling advantage arises. IOW, 2.3 compatibility is +# strongly preferred, but not guaranteed. + +# Also, this module should be kept in sync with the latest updates of +# the IBM specification as it evolves. Those updates will be treated +# as bug fixes (deviation from the spec is a compatibility, usability +# bug) and will be backported. At this point the spec is stabilizing +# and the updates are becoming fewer, smaller, and less significant. + +""" +This is a Py2.3 implementation of decimal floating point arithmetic based on +the General Decimal Arithmetic Specification: + + www2.hursley.ibm.com/decimal/decarith.html + +and IEEE standard 854-1987: + + www.cs.berkeley.edu/~ejr/projects/754/private/drafts/854-1987/dir.html + +Decimal floating point has finite precision with arbitrarily large bounds. + +The purpose of this module is to support arithmetic using familiar +"schoolhouse" rules and to avoid some of the tricky representation +issues associated with binary floating point. The package is especially +useful for financial applications or for contexts where users have +expectations that are at odds with binary floating point (for instance, +in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead +of the expected Decimal("0.00") returned by decimal floating point). + +Here are some examples of using the decimal module: + +>>> from decimal import * +>>> setcontext(ExtendedContext) +>>> Decimal(0) +Decimal("0") +>>> Decimal("1") +Decimal("1") +>>> Decimal("-.0123") +Decimal("-0.0123") +>>> Decimal(123456) +Decimal("123456") +>>> Decimal("123.45e12345678901234567890") +Decimal("1.2345E+12345678901234567892") +>>> Decimal("1.33") + Decimal("1.27") +Decimal("2.60") +>>> Decimal("12.34") + Decimal("3.87") - Decimal("18.41") +Decimal("-2.20") +>>> dig = Decimal(1) +>>> print dig / Decimal(3) +0.333333333 +>>> getcontext().prec = 18 +>>> print dig / Decimal(3) +0.333333333333333333 +>>> print dig.sqrt() +1 +>>> print Decimal(3).sqrt() +1.73205080756887729 +>>> print Decimal(3) ** 123 +4.85192780976896427E+58 +>>> inf = Decimal(1) / Decimal(0) +>>> print inf +Infinity +>>> neginf = Decimal(-1) / Decimal(0) +>>> print neginf +-Infinity +>>> print neginf + inf +NaN +>>> print neginf * inf +-Infinity +>>> print dig / 0 +Infinity +>>> getcontext().traps[DivisionByZero] = 1 +>>> print dig / 0 +Traceback (most recent call last): + ... + ... + ... +DivisionByZero: x / 0 +>>> c = Context() +>>> c.traps[InvalidOperation] = 0 +>>> print c.flags[InvalidOperation] +0 +>>> c.divide(Decimal(0), Decimal(0)) +Decimal("NaN") +>>> c.traps[InvalidOperation] = 1 +>>> print c.flags[InvalidOperation] +1 +>>> c.flags[InvalidOperation] = 0 +>>> print c.flags[InvalidOperation] +0 +>>> print c.divide(Decimal(0), Decimal(0)) +Traceback (most recent call last): + ... + ... + ... +InvalidOperation: 0 / 0 +>>> print c.flags[InvalidOperation] +1 +>>> c.flags[InvalidOperation] = 0 +>>> c.traps[InvalidOperation] = 0 +>>> print c.divide(Decimal(0), Decimal(0)) +NaN +>>> print c.flags[InvalidOperation] +1 +>>> +""" + +__all__ = [ + # Two major classes + 'Decimal', 'Context', + + # Contexts + 'DefaultContext', 'BasicContext', 'ExtendedContext', + + # Exceptions + 'DecimalException', 'Clamped', 'InvalidOperation', 'DivisionByZero', + 'Inexact', 'Rounded', 'Subnormal', 'Overflow', 'Underflow', + + # Constants for use in setting up contexts + 'ROUND_DOWN', 'ROUND_HALF_UP', 'ROUND_HALF_EVEN', 'ROUND_CEILING', + 'ROUND_FLOOR', 'ROUND_UP', 'ROUND_HALF_DOWN', 'ROUND_05UP', + + # Functions for manipulating contexts + 'setcontext', 'getcontext', 'localcontext' +] + +import copy as _copy + +# Rounding +ROUND_DOWN = 'ROUND_DOWN' +ROUND_HALF_UP = 'ROUND_HALF_UP' +ROUND_HALF_EVEN = 'ROUND_HALF_EVEN' +ROUND_CEILING = 'ROUND_CEILING' +ROUND_FLOOR = 'ROUND_FLOOR' +ROUND_UP = 'ROUND_UP' +ROUND_HALF_DOWN = 'ROUND_HALF_DOWN' +ROUND_05UP = 'ROUND_05UP' + +# Errors + +class DecimalException(ArithmeticError): + """Base exception class. + + Used exceptions derive from this. + If an exception derives from another exception besides this (such as + Underflow (Inexact, Rounded, Subnormal) that indicates that it is only + called if the others are present. This isn't actually used for + anything, though. + + handle -- Called when context._raise_error is called and the + trap_enabler is set. First argument is self, second is the + context. More arguments can be given, those being after + the explanation in _raise_error (For example, + context._raise_error(NewError, '(-x)!', self._sign) would + call NewError().handle(context, self._sign).) + + To define a new exception, it should be sufficient to have it derive + from DecimalException. + """ + def handle(self, context, *args): + pass + + +class Clamped(DecimalException): + """Exponent of a 0 changed to fit bounds. + + This occurs and signals clamped if the exponent of a result has been + altered in order to fit the constraints of a specific concrete + representation. This may occur when the exponent of a zero result would + be outside the bounds of a representation, or when a large normal + number would have an encoded exponent that cannot be represented. In + this latter case, the exponent is reduced to fit and the corresponding + number of zero digits are appended to the coefficient ("fold-down"). + """ + +class InvalidOperation(DecimalException): + """An invalid operation was performed. + + Various bad things cause this: + + Something creates a signaling NaN + -INF + INF + 0 * (+-)INF + (+-)INF / (+-)INF + x % 0 + (+-)INF % x + x._rescale( non-integer ) + sqrt(-x) , x > 0 + 0 ** 0 + x ** (non-integer) + x ** (+-)INF + An operand is invalid + + The result of the operation after these is a quiet positive NaN, + except when the cause is a signaling NaN, in which case the result is + also a quiet NaN, but with the original sign, and an optional + diagnostic information. + """ + def handle(self, context, *args): + if args: + ans = _dec_from_triple(args[0]._sign, args[0]._int, 'n', True) + return ans._fix_nan(context) + return NaN + +class ConversionSyntax(InvalidOperation): + """Trying to convert badly formed string. + + This occurs and signals invalid-operation if an string is being + converted to a number and it does not conform to the numeric string + syntax. The result is [0,qNaN]. + """ + def handle(self, context, *args): + return NaN + +class DivisionByZero(DecimalException, ZeroDivisionError): + """Division by 0. + + This occurs and signals division-by-zero if division of a finite number + by zero was attempted (during a divide-integer or divide operation, or a + power operation with negative right-hand operand), and the dividend was + not zero. + + The result of the operation is [sign,inf], where sign is the exclusive + or of the signs of the operands for divide, or is 1 for an odd power of + -0, for power. + """ + + def handle(self, context, sign, *args): + return Infsign[sign] + +class DivisionImpossible(InvalidOperation): + """Cannot perform the division adequately. + + This occurs and signals invalid-operation if the integer result of a + divide-integer or remainder operation had too many digits (would be + longer than precision). The result is [0,qNaN]. + """ + + def handle(self, context, *args): + return NaN + +class DivisionUndefined(InvalidOperation, ZeroDivisionError): + """Undefined result of division. + + This occurs and signals invalid-operation if division by zero was + attempted (during a divide-integer, divide, or remainder operation), and + the dividend is also zero. The result is [0,qNaN]. + """ + + def handle(self, context, *args): + return NaN + +class Inexact(DecimalException): + """Had to round, losing information. + + This occurs and signals inexact whenever the result of an operation is + not exact (that is, it needed to be rounded and any discarded digits + were non-zero), or if an overflow or underflow condition occurs. The + result in all cases is unchanged. + + The inexact signal may be tested (or trapped) to determine if a given + operation (or sequence of operations) was inexact. + """ + +class InvalidContext(InvalidOperation): + """Invalid context. Unknown rounding, for example. + + This occurs and signals invalid-operation if an invalid context was + detected during an operation. This can occur if contexts are not checked + on creation and either the precision exceeds the capability of the + underlying concrete representation or an unknown or unsupported rounding + was specified. These aspects of the context need only be checked when + the values are required to be used. The result is [0,qNaN]. + """ + + def handle(self, context, *args): + return NaN + +class Rounded(DecimalException): + """Number got rounded (not necessarily changed during rounding). + + This occurs and signals rounded whenever the result of an operation is + rounded (that is, some zero or non-zero digits were discarded from the + coefficient), or if an overflow or underflow condition occurs. The + result in all cases is unchanged. + + The rounded signal may be tested (or trapped) to determine if a given + operation (or sequence of operations) caused a loss of precision. + """ + +class Subnormal(DecimalException): + """Exponent < Emin before rounding. + + This occurs and signals subnormal whenever the result of a conversion or + operation is subnormal (that is, its adjusted exponent is less than + Emin, before any rounding). The result in all cases is unchanged. + + The subnormal signal may be tested (or trapped) to determine if a given + or operation (or sequence of operations) yielded a subnormal result. + """ + +class Overflow(Inexact, Rounded): + """Numerical overflow. + + This occurs and signals overflow if the adjusted exponent of a result + (from a conversion or from an operation that is not an attempt to divide + by zero), after rounding, would be greater than the largest value that + can be handled by the implementation (the value Emax). + + The result depends on the rounding mode: + + For round-half-up and round-half-even (and for round-half-down and + round-up, if implemented), the result of the operation is [sign,inf], + where sign is the sign of the intermediate result. For round-down, the + result is the largest finite number that can be represented in the + current precision, with the sign of the intermediate result. For + round-ceiling, the result is the same as for round-down if the sign of + the intermediate result is 1, or is [0,inf] otherwise. For round-floor, + the result is the same as for round-down if the sign of the intermediate + result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded + will also be raised. + """ + + def handle(self, context, sign, *args): + if context.rounding in (ROUND_HALF_UP, ROUND_HALF_EVEN, + ROUND_HALF_DOWN, ROUND_UP): + return Infsign[sign] + if sign == 0: + if context.rounding == ROUND_CEILING: + return Infsign[sign] + return _dec_from_triple(sign, '9'*context.prec, + context.Emax-context.prec+1) + if sign == 1: + if context.rounding == ROUND_FLOOR: + return Infsign[sign] + return _dec_from_triple(sign, '9'*context.prec, + context.Emax-context.prec+1) + + +class Underflow(Inexact, Rounded, Subnormal): + """Numerical underflow with result rounded to 0. + + This occurs and signals underflow if a result is inexact and the + adjusted exponent of the result would be smaller (more negative) than + the smallest value that can be handled by the implementation (the value + Emin). That is, the result is both inexact and subnormal. + + The result after an underflow will be a subnormal number rounded, if + necessary, so that its exponent is not less than Etiny. This may result + in 0 with the sign of the intermediate result and an exponent of Etiny. + + In all cases, Inexact, Rounded, and Subnormal will also be raised. + """ + +# List of public traps and flags +_signals = [Clamped, DivisionByZero, Inexact, Overflow, Rounded, + Underflow, InvalidOperation, Subnormal] + +# Map conditions (per the spec) to signals +_condition_map = {ConversionSyntax:InvalidOperation, + DivisionImpossible:InvalidOperation, + DivisionUndefined:InvalidOperation, + InvalidContext:InvalidOperation} + +##### Context Functions ################################################## + +# The getcontext() and setcontext() function manage access to a thread-local +# current context. Py2.4 offers direct support for thread locals. If that +# is not available, use threading.currentThread() which is slower but will +# work for older Pythons. If threads are not part of the build, create a +# mock threading object with threading.local() returning the module namespace. + +try: + import threading +except ImportError: + # Python was compiled without threads; create a mock object instead + import sys + class MockThreading(object): + def local(self, sys=sys): + return sys.modules[__name__] + threading = MockThreading() + del sys, MockThreading + +try: + threading.local + +except AttributeError: + + # To fix reloading, force it to create a new context + # Old contexts have different exceptions in their dicts, making problems. + if hasattr(threading.currentThread(), '__decimal_context__'): + del threading.currentThread().__decimal_context__ + + def setcontext(context): + """Set this thread's context to context.""" + if context in (DefaultContext, BasicContext, ExtendedContext): + context = context.copy() + context.clear_flags() + threading.currentThread().__decimal_context__ = context + + def getcontext(): + """Returns this thread's context. + + If this thread does not yet have a context, returns + a new context and sets this thread's context. + New contexts are copies of DefaultContext. + """ + try: + return threading.currentThread().__decimal_context__ + except AttributeError: + context = Context() + threading.currentThread().__decimal_context__ = context + return context + +else: + + local = threading.local() + if hasattr(local, '__decimal_context__'): + del local.__decimal_context__ + + def getcontext(_local=local): + """Returns this thread's context. + + If this thread does not yet have a context, returns + a new context and sets this thread's context. + New contexts are copies of DefaultContext. + """ + try: + return _local.__decimal_context__ + except AttributeError: + context = Context() + _local.__decimal_context__ = context + return context + + def setcontext(context, _local=local): + """Set this thread's context to context.""" + if context in (DefaultContext, BasicContext, ExtendedContext): + context = context.copy() + context.clear_flags() + _local.__decimal_context__ = context + + del threading, local # Don't contaminate the namespace + +def localcontext(ctx=None): + """Return a context manager for a copy of the supplied context + + Uses a copy of the current context if no context is specified + The returned context manager creates a local decimal context + in a with statement: + def sin(x): + with localcontext() as ctx: + ctx.prec += 2 + # Rest of sin calculation algorithm + # uses a precision 2 greater than normal + return +s # Convert result to normal precision + + def sin(x): + with localcontext(ExtendedContext): + # Rest of sin calculation algorithm + # uses the Extended Context from the + # General Decimal Arithmetic Specification + return +s # Convert result to normal context + + """ + # The string below can't be included in the docstring until Python 2.6 + # as the doctest module doesn't understand __future__ statements + """ + >>> from __future__ import with_statement + >>> print getcontext().prec + 28 + >>> with localcontext(): + ... ctx = getcontext() + ... ctx.prec += 2 + ... print ctx.prec + ... + 30 + >>> with localcontext(ExtendedContext): + ... print getcontext().prec + ... + 9 + >>> print getcontext().prec + 28 + """ + if ctx is None: ctx = getcontext() + return _ContextManager(ctx) + + +##### Decimal class ####################################################### + +class Decimal(object): + """Floating point class for decimal arithmetic.""" + + __slots__ = ('_exp','_int','_sign', '_is_special') + # Generally, the value of the Decimal instance is given by + # (-1)**_sign * _int * 10**_exp + # Special values are signified by _is_special == True + + # We're immutable, so use __new__ not __init__ + def __new__(cls, value="0", context=None): + """Create a decimal point instance. + + >>> Decimal('3.14') # string input + Decimal("3.14") + >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent) + Decimal("3.14") + >>> Decimal(314) # int or long + Decimal("314") + >>> Decimal(Decimal(314)) # another decimal instance + Decimal("314") + """ + + # Note that the coefficient, self._int, is actually stored as + # a string rather than as a tuple of digits. This speeds up + # the "digits to integer" and "integer to digits" conversions + # that are used in almost every arithmetic operation on + # Decimals. This is an internal detail: the as_tuple function + # and the Decimal constructor still deal with tuples of + # digits. + + self = object.__new__(cls) + + # From a string + # REs insist on real strings, so we can too. + if isinstance(value, basestring): + m = _parser(value) + if m is None: + if context is None: + context = getcontext() + return context._raise_error(ConversionSyntax, + "Invalid literal for Decimal: %r" % value) + + if m.group('sign') == "-": + self._sign = 1 + else: + self._sign = 0 + intpart = m.group('int') + if intpart is not None: + # finite number + fracpart = m.group('frac') + exp = int(m.group('exp') or '0') + if fracpart is not None: + self._int = str((intpart+fracpart).lstrip('0') or '0') + self._exp = exp - len(fracpart) + else: + self._int = str(intpart.lstrip('0') or '0') + self._exp = exp + self._is_special = False + else: + diag = m.group('diag') + if diag is not None: + # NaN + self._int = str(diag.lstrip('0')) + if m.group('signal'): + self._exp = 'N' + else: + self._exp = 'n' + else: + # infinity + self._int = '0' + self._exp = 'F' + self._is_special = True + return self + + # From an integer + if isinstance(value, (int,long)): + if value >= 0: + self._sign = 0 + else: + self._sign = 1 + self._exp = 0 + self._int = str(abs(value)) + self._is_special = False + return self + + # From another decimal + if isinstance(value, Decimal): + self._exp = value._exp + self._sign = value._sign + self._int = value._int + self._is_special = value._is_special + return self + + # From an internal working value + if isinstance(value, _WorkRep): + self._sign = value.sign + self._int = str(value.int) + self._exp = int(value.exp) + self._is_special = False + return self + + # tuple/list conversion (possibly from as_tuple()) + if isinstance(value, (list,tuple)): + if len(value) != 3: + raise ValueError('Invalid tuple size in creation of Decimal ' + 'from list or tuple. The list or tuple ' + 'should have exactly three elements.') + # process sign. The isinstance test rejects floats + if not (isinstance(value[0], (int, long)) and value[0] in (0,1)): + raise ValueError("Invalid sign. The first value in the tuple " + "should be an integer; either 0 for a " + "positive number or 1 for a negative number.") + self._sign = value[0] + if value[2] == 'F': + # infinity: value[1] is ignored + self._int = '0' + self._exp = value[2] + self._is_special = True + else: + # process and validate the digits in value[1] + digits = [] + for digit in value[1]: + if isinstance(digit, (int, long)) and 0 <= digit <= 9: + # skip leading zeros + if digits or digit != 0: + digits.append(digit) + else: + raise ValueError("The second value in the tuple must " + "be composed of integers in the range " + "0 through 9.") + if value[2] in ('n', 'N'): + # NaN: digits form the diagnostic + self._int = ''.join(map(str, digits)) + self._exp = value[2] + self._is_special = True + elif isinstance(value[2], (int, long)): + # finite number: digits give the coefficient + self._int = ''.join(map(str, digits or [0])) + self._exp = value[2] + self._is_special = False + else: + raise ValueError("The third value in the tuple must " + "be an integer, or one of the " + "strings 'F', 'n', 'N'.") + return self + + if isinstance(value, float): + raise TypeError("Cannot convert float to Decimal. " + + "First convert the float to a string") + + raise TypeError("Cannot convert %r to Decimal" % value) + + def _isnan(self): + """Returns whether the number is not actually one. + + 0 if a number + 1 if NaN + 2 if sNaN + """ + if self._is_special: + exp = self._exp + if exp == 'n': + return 1 + elif exp == 'N': + return 2 + return 0 + + def _isinfinity(self): + """Returns whether the number is infinite + + 0 if finite or not a number + 1 if +INF + -1 if -INF + """ + if self._exp == 'F': + if self._sign: + return -1 + return 1 + return 0 + + def _check_nans(self, other=None, context=None): + """Returns whether the number is not actually one. + + if self, other are sNaN, signal + if self, other are NaN return nan + return 0 + + Done before operations. + """ + + self_is_nan = self._isnan() + if other is None: + other_is_nan = False + else: + other_is_nan = other._isnan() + + if self_is_nan or other_is_nan: + if context is None: + context = getcontext() + + if self_is_nan == 2: + return context._raise_error(InvalidOperation, 'sNaN', + self) + if other_is_nan == 2: + return context._raise_error(InvalidOperation, 'sNaN', + other) + if self_is_nan: + return self._fix_nan(context) + + return other._fix_nan(context) + return 0 + + def __nonzero__(self): + """Return True if self is nonzero; otherwise return False. + + NaNs and infinities are considered nonzero. + """ + return self._is_special or self._int != '0' + + def __cmp__(self, other): + other = _convert_other(other) + if other is NotImplemented: + # Never return NotImplemented + return 1 + + if self._is_special or other._is_special: + # check for nans, without raising on a signaling nan + if self._isnan() or other._isnan(): + return 1 # Comparison involving NaN's always reports self > other + + # INF = INF + return cmp(self._isinfinity(), other._isinfinity()) + + # check for zeros; note that cmp(0, -0) should return 0 + if not self: + if not other: + return 0 + else: + return -((-1)**other._sign) + if not other: + return (-1)**self._sign + + # If different signs, neg one is less + if other._sign < self._sign: + return -1 + if self._sign < other._sign: + return 1 + + self_adjusted = self.adjusted() + other_adjusted = other.adjusted() + if self_adjusted == other_adjusted: + self_padded = self._int + '0'*(self._exp - other._exp) + other_padded = other._int + '0'*(other._exp - self._exp) + return cmp(self_padded, other_padded) * (-1)**self._sign + elif self_adjusted > other_adjusted: + return (-1)**self._sign + else: # self_adjusted < other_adjusted + return -((-1)**self._sign) + + def __eq__(self, other): + if not isinstance(other, (Decimal, int, long)): + return NotImplemented + return self.__cmp__(other) == 0 + + def __ne__(self, other): + if not isinstance(other, (Decimal, int, long)): + return NotImplemented + return self.__cmp__(other) != 0 + + def compare(self, other, context=None): + """Compares one to another. + + -1 => a < b + 0 => a = b + 1 => a > b + NaN => one is NaN + Like __cmp__, but returns Decimal instances. + """ + other = _convert_other(other, raiseit=True) + + # Compare(NaN, NaN) = NaN + if (self._is_special or other and other._is_special): + ans = self._check_nans(other, context) + if ans: + return ans + + return Decimal(self.__cmp__(other)) + + def __hash__(self): + """x.__hash__() <==> hash(x)""" + # Decimal integers must hash the same as the ints + # + # The hash of a nonspecial noninteger Decimal must depend only + # on the value of that Decimal, and not on its representation. + # For example: hash(Decimal("100E-1")) == hash(Decimal("10")). + if self._is_special: + if self._isnan(): + raise TypeError('Cannot hash a NaN value.') + return hash(str(self)) + if not self: + return 0 + if self._isinteger(): + op = _WorkRep(self.to_integral_value()) + return hash((-1)**op.sign*op.int*10**op.exp) + # The value of a nonzero nonspecial Decimal instance is + # faithfully represented by the triple consisting of its sign, + # its adjusted exponent, and its coefficient with trailing + # zeros removed. + return hash((self._sign, + self._exp+len(self._int), + self._int.rstrip('0'))) + + def as_tuple(self): + """Represents the number as a triple tuple. + + To show the internals exactly as they are. + """ + return (self._sign, tuple(map(int, self._int)), self._exp) + + def __repr__(self): + """Represents the number as an instance of Decimal.""" + # Invariant: eval(repr(d)) == d + return 'Decimal("%s")' % str(self) + + def __str__(self, eng=False, context=None): + """Return string representation of the number in scientific notation. + + Captures all of the information in the underlying representation. + """ + + sign = ['', '-'][self._sign] + if self._is_special: + if self._exp == 'F': + return sign + 'Infinity' + elif self._exp == 'n': + return sign + 'NaN' + self._int + else: # self._exp == 'N' + return sign + 'sNaN' + self._int + + # number of digits of self._int to left of decimal point + leftdigits = self._exp + len(self._int) + + # dotplace is number of digits of self._int to the left of the + # decimal point in the mantissa of the output string (that... [truncated message content] |
From: <th...@us...> - 2008-09-03 09:21:40
|
Revision: 5286 http://jython.svn.sourceforge.net/jython/?rev=5286&view=rev Author: thobes Date: 2008-09-03 09:21:25 +0000 (Wed, 03 Sep 2008) Log Message: ----------- Merged revisions 5211-5215,5227,5229,5231-5234,5262-5271,5274-5276,5278-5279,5281-5285 via svnmerge from https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython ................ r5211 | pjenvey | 2008-08-20 01:34:29 +0200 (Wed, 20 Aug 2008) | 2 lines small cleanup ................ r5212 | pjenvey | 2008-08-20 02:28:55 +0200 (Wed, 20 Aug 2008) | 4 lines o rename unmarshalCode -> readCode, as it doesn't relate to Python's marshal o zipimport shouldn't cacheCompiledSource (it's just been silently failing), and use java enums ................ r5213 | nriley | 2008-08-20 06:33:02 +0200 (Wed, 20 Aug 2008) | 1 line Run Jython regrtest (on Windows) with bytecode verification; support -J, --jdb, -- on Windows too. ................ r5214 | nriley | 2008-08-20 07:26:20 +0200 (Wed, 20 Aug 2008) | 1 line Turned out those quotes were useful after all. ................ r5215 | zyasoft | 2008-08-20 08:54:10 +0200 (Wed, 20 Aug 2008) | 5 lines A class definition needs to have __module__ set in frame locals, so that it is accessible by a metaclass, if defined. Fixes test_advice in zope.interfaces ................ r5227 | pjenvey | 2008-08-21 01:01:42 +0200 (Thu, 21 Aug 2008) | 3 lines rewrite the subx joiner yet again: this time exactly as CPython does it, with __getslice__ and join. fixes a string subclass corner case ................ r5229 | leosoto | 2008-08-21 05:23:28 +0200 (Thu, 21 Aug 2008) | 1 line Fixing #1095 for old-style classes. Thanks to Anselm Kruls for the patch. ................ r5231 | pjenvey | 2008-08-21 21:44:29 +0200 (Thu, 21 Aug 2008) | 3 lines make cStringIO thread safe as unfortunately the CPython GIL guarantees it, as does the pure python version. add cStringIO.In/OutputType ................ r5232 | pjenvey | 2008-08-22 01:59:46 +0200 (Fri, 22 Aug 2008) | 1 line document TypeError vs AttributeError here ................ r5233 | fwierzbicki | 2008-08-22 17:31:56 +0200 (Fri, 22 Aug 2008) | 2 lines Switch "type"->"kind" for the compile parameter value which specifies the kind of parse/compile "exec", "eval", or "single". CPython's source uses "kind" and other parts of Jython use this term as well. ................ r5234 | pjenvey | 2008-08-22 22:16:59 +0200 (Fri, 22 Aug 2008) | 3 lines fix unicode __add__ and repeat always forcing the basic plane on the result -- can't optimize for strs when unicode also uses these methods ................ r5262 | fwierzbicki | 2008-08-29 14:11:43 +0200 (Fri, 29 Aug 2008) | 3 lines Leaving out two of the harder parts of test_inspect out for now (with comments to come back to them later). ................ r5263 | fwierzbicki | 2008-08-29 14:14:12 +0200 (Fri, 29 Aug 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-5209" from https://jython.svn.sourceforge.net/svnroot/jython/branches/nowalker ................ r5264 | fwierzbicki | 2008-08-29 15:47:16 +0200 (Fri, 29 Aug 2008) | 168 lines Merged revisions 5210,5216-5220,5223-5226,5228,5230,5236-5261 via svnmerge from https://jython.svn.sourceforge.net/svnroot/jython/branches/nowalker ........ r5210 | fwierzbicki | 2008-08-19 17:43:06 -0400 (Tue, 19 Aug 2008) | 5 lines Work to date on the one pass grammar. Not ready for others to look at really. If you really want to try it note that you need to comment out parts of site.py and os.py to get things to work. They *almost* parse and compile, but not quite, and they are basic dependencies for Jython to run. ........ r5216 | fwierzbicki | 2008-08-20 08:10:26 -0400 (Wed, 20 Aug 2008) | 2 lines Much better BoolOp. ........ r5217 | fwierzbicki | 2008-08-20 10:06:30 -0400 (Wed, 20 Aug 2008) | 2 lines Fix "del". ........ r5218 | fwierzbicki | 2008-08-20 10:39:21 -0400 (Wed, 20 Aug 2008) | 2 lines Dict support. ........ r5219 | fwierzbicki | 2008-08-20 11:23:14 -0400 (Wed, 20 Aug 2008) | 2 lines Conditional Expression support. ........ r5220 | fwierzbicki | 2008-08-20 11:37:02 -0400 (Wed, 20 Aug 2008) | 2 lines repr support. ........ r5223 | fwierzbicki | 2008-08-20 15:57:39 -0400 (Wed, 20 Aug 2008) | 2 lines Start of list comprehensions and generator expressions. ........ r5224 | fwierzbicki | 2008-08-20 15:58:17 -0400 (Wed, 20 Aug 2008) | 2 lines oops revert build.xml ........ r5225 | fwierzbicki | 2008-08-20 16:57:09 -0400 (Wed, 20 Aug 2008) | 2 lines re-remove PythonWalker.g from build ........ r5226 | fwierzbicki | 2008-08-20 16:59:44 -0400 (Wed, 20 Aug 2008) | 2 lines gen expressions and list comps now actually work... ........ r5228 | fwierzbicki | 2008-08-20 22:58:24 -0400 (Wed, 20 Aug 2008) | 2 lines debugging of some expr_contextType values. ........ r5230 | fwierzbicki | 2008-08-20 23:47:32 -0400 (Wed, 20 Aug 2008) | 2 lines bugfix on exception and on assign value expr_contextType. ........ r5236 | fwierzbicki | 2008-08-22 19:03:45 -0400 (Fri, 22 Aug 2008) | 2 lines Bugfix for expr_contextType on assign values. ........ r5237 | fwierzbicki | 2008-08-22 22:33:48 -0400 (Fri, 22 Aug 2008) | 2 lines Add expr types to BaseTree children. ........ r5238 | fwierzbicki | 2008-08-23 15:19:16 -0400 (Sat, 23 Aug 2008) | 2 lines BinOp now works in one pass. ........ r5239 | fwierzbicki | 2008-08-23 15:43:19 -0400 (Sat, 23 Aug 2008) | 2 lines Fine tuning List and Assign col position. ........ r5240 | fwierzbicki | 2008-08-23 19:03:59 -0400 (Sat, 23 Aug 2008) | 5 lines Make PythonTree's toStringTree more easily comparable with ast/astview.py output. This will help with the walkerless Python.g, as it doesn't quite parse ast/astview.py yet. ........ r5241 | fwierzbicki | 2008-08-23 22:04:43 -0400 (Sat, 23 Aug 2008) | 2 lines Fix lambda without args. ........ r5242 | fwierzbicki | 2008-08-24 05:38:22 -0400 (Sun, 24 Aug 2008) | 2 lines check for PythonTree in makeStmts. ........ r5243 | fwierzbicki | 2008-08-25 10:21:29 -0400 (Mon, 25 Aug 2008) | 2 lines Fix generator expressions, rename all "stmts" in Python.g to "stypes". ........ r5244 | fwierzbicki | 2008-08-25 11:25:24 -0400 (Mon, 25 Aug 2008) | 2 lines Clean up creation of stmtType[] and exprType[]. ........ r5245 | fwierzbicki | 2008-08-25 14:44:46 -0400 (Mon, 25 Aug 2008) | 3 lines Fix build.xml (oops) Fix Generator Expression assignments and multi-statement simple_stmt. ........ r5246 | fwierzbicki | 2008-08-25 16:36:04 -0400 (Mon, 25 Aug 2008) | 3 lines Fixed fplist, subscripts (especially extslice) and enable Interactive and Expression (single and eval). regrtest.py is now running. ........ r5247 | fwierzbicki | 2008-08-25 17:18:03 -0400 (Mon, 25 Aug 2008) | 2 lines Fix ** ........ r5248 | fwierzbicki | 2008-08-25 22:04:27 -0400 (Mon, 25 Aug 2008) | 3 lines Cleanup: removal of comments, re-format of Python.g and removal of PYNODE. ........ r5249 | fwierzbicki | 2008-08-26 08:21:42 -0400 (Tue, 26 Aug 2008) | 3 lines Remove unnecessary constructor on BinOp (now it is just the generated version again) Remove some whitespace in Python.g ........ r5250 | fwierzbicki | 2008-08-26 11:05:19 -0400 (Tue, 26 Aug 2008) | 2 lines Moved makeSliceType code to GrammarActions. ........ r5251 | fwierzbicki | 2008-08-26 12:51:15 -0400 (Tue, 26 Aug 2008) | 2 lines Moved Subscript creation up a rule - fixed a bunch of unit tests. ........ r5252 | fwierzbicki | 2008-08-26 15:37:34 -0400 (Tue, 26 Aug 2008) | 2 lines Another expr_contextType adjustment. ........ r5253 | fwierzbicki | 2008-08-26 16:17:50 -0400 (Tue, 26 Aug 2008) | 2 lines checking for bad assignment statements. ........ r5254 | fwierzbicki | 2008-08-26 20:44:35 -0400 (Tue, 26 Aug 2008) | 3 lines Fix illegal Lambda statements and more illegal assigns. Also raise exceptions on illegal gen expression arguments. ........ r5255 | fwierzbicki | 2008-08-26 22:38:35 -0400 (Tue, 26 Aug 2008) | 2 lines Fix for FunctionDef and Call problems. ........ r5256 | fwierzbicki | 2008-08-26 22:47:56 -0400 (Tue, 26 Aug 2008) | 2 lines whitespace ........ r5257 | fwierzbicki | 2008-08-27 12:07:35 -0400 (Wed, 27 Aug 2008) | 2 lines revert build.xml after accidently checking in my local copy. ........ r5258 | fwierzbicki | 2008-08-27 15:51:16 -0400 (Wed, 27 Aug 2008) | 2 lines for not_test, replacing manual tree construction with ->. ........ r5259 | fwierzbicki | 2008-08-27 16:09:39 -0400 (Wed, 27 Aug 2008) | 2 lines TODO comment. ........ r5260 | fwierzbicki | 2008-08-27 16:35:54 -0400 (Wed, 27 Aug 2008) | 3 lines Removed XXX comments that no longer apply (special testlists don't seem to be needed). Removed unused c1 and c2 alias. ........ r5261 | fwierzbicki | 2008-08-27 16:51:19 -0400 (Wed, 27 Aug 2008) | 2 lines simplify testlist. ........ ................ r5265 | nriley | 2008-08-29 21:51:57 +0200 (Fri, 29 Aug 2008) | 1 line filecmp.py from http://svn.python.org/projects/python/branches/release25-maint/Lib/filecmp.py r66059 ................ r5266 | nriley | 2008-08-29 21:53:04 +0200 (Fri, 29 Aug 2008) | 1 line Close file immediately after comparing it. Fixes test_filecmp on Windows. ................ r5267 | nriley | 2008-08-29 21:55:43 +0200 (Fri, 29 Aug 2008) | 1 line Correct file position after truncate; similar to CPython's bug <http://bugs.python.org/issue801631>. Fixes test_file on Windows. ................ r5268 | nriley | 2008-08-29 21:56:54 +0200 (Fri, 29 Aug 2008) | 1 line Fix some mispasted docstrings in the grp module. ................ r5269 | nriley | 2008-08-29 21:58:06 +0200 (Fri, 29 Aug 2008) | 1 line Raise ImportError when attempting to import pwd, grp modules on Windows. Fixes test_tarfile. ................ r5270 | nriley | 2008-08-29 22:41:41 +0200 (Fri, 29 Aug 2008) | 1 line Revert stubbed out bit from r5210. ................ r5271 | pjenvey | 2008-08-29 23:08:52 +0200 (Fri, 29 Aug 2008) | 3 lines PEP 338 (jython -m mod) support patch from Georgy Berdyshev ................ r5274 | zyasoft | 2008-08-30 20:39:59 +0200 (Sat, 30 Aug 2008) | 22 lines Exposed unicode_toString, str_toString so that Jython code can directly access the underlying java.lang.String backing our unicode and str types. This enables writing code like this: return Normalizer.normalize(unistr.toString(), normalizer_form) without Jython automatically encoding the string on our behalf. That's often what we want for CPython compatibility, but not when we are calling methods like this. (Too bad we need to know.) Added unicodedata.py and supporting data files UnicodeData.txt and EastAsianWidth.txt, both from 4.10. (We may wish to update to be more compliant with Java than Python 2.5.) Because the time it takes to import, serious refactoring should be considered, including possibly doing a codegen to Java approach. Currently does not pass MD5 hash tests in test_unicodedata, which by their nature are highly sensitive. Added collections.namedtuple. First 2.6 feature. (We should have a few in Jython 2.5.) This was originally added to support Python version of unicodedata.py, but is now just included. ................ r5275 | fwierzbicki | 2008-08-31 02:31:36 +0200 (Sun, 31 Aug 2008) | 3 lines Fixes #1116 -- dotted_attr was calling itself, which does not make sense with +=. ................ r5276 | fwierzbicki | 2008-08-31 03:00:57 +0200 (Sun, 31 Aug 2008) | 2 lines Test for more than 2 dotted_attr. See http://bugs.jython.org/issue1116. ................ r5278 | fwierzbicki | 2008-09-01 06:21:27 +0200 (Mon, 01 Sep 2008) | 2 lines Check for EOF in file_input. Comment cleanup. ................ r5279 | zyasoft | 2008-09-01 08:32:39 +0200 (Mon, 01 Sep 2008) | 6 lines The compile builtin function now can take an AST node, as produced by a previous usage of compile with the compiler flag _ast.PyCF_ONLY_AST. Generally this would be after some modification of the AST itself. Another 2.6 feature. ................ r5281 | fwierzbicki | 2008-09-02 16:41:10 +0200 (Tue, 02 Sep 2008) | 2 lines Coding standards and cosmetic changes. ................ r5282 | fwierzbicki | 2008-09-02 16:43:50 +0200 (Tue, 02 Sep 2008) | 2 lines accidentally commented out call to dump() which is turned off by default anyway. ................ r5283 | fwierzbicki | 2008-09-03 02:19:22 +0200 (Wed, 03 Sep 2008) | 2 lines Remove unused file. ................ r5284 | fwierzbicki | 2008-09-03 02:25:53 +0200 (Wed, 03 Sep 2008) | 3 lines from: http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_code.py@51333 ................ r5285 | fwierzbicki | 2008-09-03 03:00:56 +0200 (Wed, 03 Sep 2008) | 6 lines Removed co_names, co_consts since these are implementation details that may never get implemented, and removed flags since there are implementation differences that may never line up. Still failing on one test for varnames because I think it is possible that the order of varnames might be useful (in order declared) and Jython doesn't quite get that right. ................ Modified Paths: -------------- branches/advanced/CPythonLib.includes branches/advanced/CoreExposed.includes branches/advanced/Lib/grp.py branches/advanced/Lib/pkgutil.py branches/advanced/Lib/pwd.py branches/advanced/Lib/test/regrtest.py branches/advanced/Lib/test/test_descr_jy.py branches/advanced/Lib/test/test_inspect.py branches/advanced/Lib/test/test_jy_compile.py branches/advanced/Lib/test/test_re_jy.py branches/advanced/ast/asdl_antlr.py branches/advanced/build.xml branches/advanced/grammar/Python.g branches/advanced/src/org/python/antlr/ExpressionParser.java branches/advanced/src/org/python/antlr/GrammarActions.java branches/advanced/src/org/python/antlr/InteractiveParser.java branches/advanced/src/org/python/antlr/ModuleParser.java branches/advanced/src/org/python/antlr/PythonTokenSource.java branches/advanced/src/org/python/antlr/ast/Assert.java branches/advanced/src/org/python/antlr/ast/Assign.java branches/advanced/src/org/python/antlr/ast/Attribute.java branches/advanced/src/org/python/antlr/ast/AugAssign.java branches/advanced/src/org/python/antlr/ast/BinOp.java branches/advanced/src/org/python/antlr/ast/Call.java branches/advanced/src/org/python/antlr/ast/Compare.java branches/advanced/src/org/python/antlr/ast/Exec.java branches/advanced/src/org/python/antlr/ast/Expr.java branches/advanced/src/org/python/antlr/ast/Expression.java branches/advanced/src/org/python/antlr/ast/For.java branches/advanced/src/org/python/antlr/ast/GeneratorExp.java branches/advanced/src/org/python/antlr/ast/If.java branches/advanced/src/org/python/antlr/ast/IfExp.java branches/advanced/src/org/python/antlr/ast/Index.java branches/advanced/src/org/python/antlr/ast/Lambda.java branches/advanced/src/org/python/antlr/ast/ListComp.java branches/advanced/src/org/python/antlr/ast/Print.java branches/advanced/src/org/python/antlr/ast/Raise.java branches/advanced/src/org/python/antlr/ast/Repr.java branches/advanced/src/org/python/antlr/ast/Return.java branches/advanced/src/org/python/antlr/ast/Slice.java branches/advanced/src/org/python/antlr/ast/Subscript.java branches/advanced/src/org/python/antlr/ast/UnaryOp.java branches/advanced/src/org/python/antlr/ast/While.java branches/advanced/src/org/python/antlr/ast/With.java branches/advanced/src/org/python/antlr/ast/Yield.java branches/advanced/src/org/python/antlr/ast/comprehensionType.java branches/advanced/src/org/python/antlr/ast/excepthandlerType.java branches/advanced/src/org/python/antlr/ast/keywordType.java branches/advanced/src/org/python/compiler/Module.java branches/advanced/src/org/python/compiler/ScopesCompiler.java branches/advanced/src/org/python/core/CompilerFacade.java branches/advanced/src/org/python/core/Py.java branches/advanced/src/org/python/core/PyBaseException.java branches/advanced/src/org/python/core/PyFrame.java branches/advanced/src/org/python/core/PyInstance.java branches/advanced/src/org/python/core/PyObject.java branches/advanced/src/org/python/core/PyString.java branches/advanced/src/org/python/core/PyUnicode.java branches/advanced/src/org/python/core/__builtin__.java branches/advanced/src/org/python/core/imp.java branches/advanced/src/org/python/core/io/FileIO.java branches/advanced/src/org/python/modules/Setup.java branches/advanced/src/org/python/modules/cStringIO.java branches/advanced/src/org/python/modules/sre/PatternObject.java branches/advanced/src/org/python/modules/zipimport/zipimporter.java branches/advanced/src/org/python/util/jython.java branches/advanced/src/shell/jython.bat branches/advanced/tests/java/org/python/antlr/PythonTreeTester.java Added Paths: ----------- branches/advanced/Lib/EastAsianWidth.txt branches/advanced/Lib/UnicodeData.txt branches/advanced/Lib/collections/ branches/advanced/Lib/collections/__init__.py branches/advanced/Lib/filecmp.py branches/advanced/Lib/test/test_code.py branches/advanced/Lib/test/test_unicode_jy.py branches/advanced/Lib/unicodedata.py branches/advanced/src/org/python/modules/_collections/ branches/advanced/src/org/python/modules/_collections/Collections.java branches/advanced/src/org/python/modules/_collections/PyDefaultDict.java branches/advanced/src/org/python/modules/_collections/PyDefaultDictDerived.java branches/advanced/src/org/python/modules/_collections/PyDeque.java branches/advanced/src/org/python/modules/_collections/PyDequeDerived.java Removed Paths: ------------- branches/advanced/Lib/collections/__init__.py branches/advanced/grammar/PythonWalker.g branches/advanced/src/org/python/compiler/SourceFile.java branches/advanced/src/org/python/modules/_collections/Collections.java branches/advanced/src/org/python/modules/_collections/PyDefaultDict.java branches/advanced/src/org/python/modules/_collections/PyDefaultDictDerived.java branches/advanced/src/org/python/modules/_collections/PyDeque.java branches/advanced/src/org/python/modules/_collections/PyDequeDerived.java branches/advanced/src/org/python/modules/collections/ Property Changed: ---------------- branches/advanced/ Property changes on: branches/advanced ___________________________________________________________________ Modified: svnmerge-integrated - /trunk/jython:1-5210 + /trunk/jython:1-5285 Modified: branches/advanced/CPythonLib.includes =================================================================== --- branches/advanced/CPythonLib.includes 2008-09-03 01:00:56 UTC (rev 5285) +++ branches/advanced/CPythonLib.includes 2008-09-03 09:21:25 UTC (rev 5286) @@ -52,7 +52,6 @@ dospath.py dumbdbm.py exceptions.py -filecmp.py fileinput.py fnmatch.py formatter.py Modified: branches/advanced/CoreExposed.includes =================================================================== --- branches/advanced/CoreExposed.includes 2008-09-03 01:00:56 UTC (rev 5285) +++ branches/advanced/CoreExposed.includes 2008-09-03 09:21:25 UTC (rev 5286) @@ -44,8 +44,8 @@ org/python/modules/_weakref/ReferenceType.class org/python/modules/_weakref/ProxyType.class org/python/modules/_hashlib$Hash.class -org/python/modules/collections/PyDefaultDict.class -org/python/modules/collections/PyDeque.class +org/python/modules/_collections/PyDefaultDict.class +org/python/modules/_collections/PyDeque.class org/python/modules/operator$PyAttrGetter.class org/python/modules/operator$PyItemGetter.class org/python/modules/random/PyRandom.class Copied: branches/advanced/Lib/EastAsianWidth.txt (from rev 5285, trunk/jython/Lib/EastAsianWidth.txt) =================================================================== --- branches/advanced/Lib/EastAsianWidth.txt (rev 0) +++ branches/advanced/Lib/EastAsianWidth.txt 2008-09-03 09:21:25 UTC (rev 5286) @@ -0,0 +1,16368 @@ +# EastAsianWidth-4.1.0.txt +# Date: 2005-03-17, 15:21:00 PST [KW] +# +# East Asian Width Properties +# +# This file is an informative contributory data file in the +# Unicode Character Database. +# +# Copyright (c) 1991-2005 Unicode, Inc. +# For terms of use, see http://www.unicode.org/terms_of_use.html +# +# The format is two fields separated by a semicolon. +# Field 0: Unicode value +# Field 1: East Asian Width property, consisting of one of the following values: +# "N", "A", "H", "W", "F", "Na" +# - All code points, assigned or unassigned, that are not listed +# explicitly are given the value "N". +# - Characters ranges are specified as for other property files in +# the Unicode Character Database. +# +# The Unicode name of each character is provided in a comment for help +# in identifying the characters. +# +# See UAX #11: East Asian Character Width, for more information. +0000;N # <control> +0001;N # <control> +0002;N # <control> +0003;N # <control> +0004;N # <control> +0005;N # <control> +0006;N # <control> +0007;N # <control> +0008;N # <control> +0009;N # <control> +000A;N # <control> +000B;N # <control> +000C;N # <control> +000D;N # <control> +000E;N # <control> +000F;N # <control> +0010;N # <control> +0011;N # <control> +0012;N # <control> +0013;N # <control> +0014;N # <control> +0015;N # <control> +0016;N # <control> +0017;N # <control> +0018;N # <control> +0019;N # <control> +001A;N # <control> +001B;N # <control> +001C;N # <control> +001D;N # <control> +001E;N # <control> +001F;N # <control> +0020;Na # SPACE +0021;Na # EXCLAMATION MARK +0022;Na # QUOTATION MARK +0023;Na # NUMBER SIGN +0024;Na # DOLLAR SIGN +0025;Na # PERCENT SIGN +0026;Na # AMPERSAND +0027;Na # APOSTROPHE +0028;Na # LEFT PARENTHESIS +0029;Na # RIGHT PARENTHESIS +002A;Na # ASTERISK +002B;Na # PLUS SIGN +002C;Na # COMMA +002D;Na # HYPHEN-MINUS +002E;Na # FULL STOP +002F;Na # SOLIDUS +0030;Na # DIGIT ZERO +0031;Na # DIGIT ONE +0032;Na # DIGIT TWO +0033;Na # DIGIT THREE +0034;Na # DIGIT FOUR +0035;Na # DIGIT FIVE +0036;Na # DIGIT SIX +0037;Na # DIGIT SEVEN +0038;Na # DIGIT EIGHT +0039;Na # DIGIT NINE +003A;Na # COLON +003B;Na # SEMICOLON +003C;Na # LESS-THAN SIGN +003D;Na # EQUALS SIGN +003E;Na # GREATER-THAN SIGN +003F;Na # QUESTION MARK +0040;Na # COMMERCIAL AT +0041;Na # LATIN CAPITAL LETTER A +0042;Na # LATIN CAPITAL LETTER B +0043;Na # LATIN CAPITAL LETTER C +0044;Na # LATIN CAPITAL LETTER D +0045;Na # LATIN CAPITAL LETTER E +0046;Na # LATIN CAPITAL LETTER F +0047;Na # LATIN CAPITAL LETTER G +0048;Na # LATIN CAPITAL LETTER H +0049;Na # LATIN CAPITAL LETTER I +004A;Na # LATIN CAPITAL LETTER J +004B;Na # LATIN CAPITAL LETTER K +004C;Na # LATIN CAPITAL LETTER L +004D;Na # LATIN CAPITAL LETTER M +004E;Na # LATIN CAPITAL LETTER N +004F;Na # LATIN CAPITAL LETTER O +0050;Na # LATIN CAPITAL LETTER P +0051;Na # LATIN CAPITAL LETTER Q +0052;Na # LATIN CAPITAL LETTER R +0053;Na # LATIN CAPITAL LETTER S +0054;Na # LATIN CAPITAL LETTER T +0055;Na # LATIN CAPITAL LETTER U +0056;Na # LATIN CAPITAL LETTER V +0057;Na # LATIN CAPITAL LETTER W +0058;Na # LATIN CAPITAL LETTER X +0059;Na # LATIN CAPITAL LETTER Y +005A;Na # LATIN CAPITAL LETTER Z +005B;Na # LEFT SQUARE BRACKET +005C;Na # REVERSE SOLIDUS +005D;Na # RIGHT SQUARE BRACKET +005E;Na # CIRCUMFLEX ACCENT +005F;Na # LOW LINE +0060;Na # GRAVE ACCENT +0061;Na # LATIN SMALL LETTER A +0062;Na # LATIN SMALL LETTER B +0063;Na # LATIN SMALL LETTER C +0064;Na # LATIN SMALL LETTER D +0065;Na # LATIN SMALL LETTER E +0066;Na # LATIN SMALL LETTER F +0067;Na # LATIN SMALL LETTER G +0068;Na # LATIN SMALL LETTER H +0069;Na # LATIN SMALL LETTER I +006A;Na # LATIN SMALL LETTER J +006B;Na # LATIN SMALL LETTER K +006C;Na # LATIN SMALL LETTER L +006D;Na # LATIN SMALL LETTER M +006E;Na # LATIN SMALL LETTER N +006F;Na # LATIN SMALL LETTER O +0070;Na # LATIN SMALL LETTER P +0071;Na # LATIN SMALL LETTER Q +0072;Na # LATIN SMALL LETTER R +0073;Na # LATIN SMALL LETTER S +0074;Na # LATIN SMALL LETTER T +0075;Na # LATIN SMALL LETTER U +0076;Na # LATIN SMALL LETTER V +0077;Na # LATIN SMALL LETTER W +0078;Na # LATIN SMALL LETTER X +0079;Na # LATIN SMALL LETTER Y +007A;Na # LATIN SMALL LETTER Z +007B;Na # LEFT CURLY BRACKET +007C;Na # VERTICAL LINE +007D;Na # RIGHT CURLY BRACKET +007E;Na # TILDE +007F;N # <control> +0080;N # <control> +0081;N # <control> +0082;N # <control> +0083;N # <control> +0084;N # <control> +0085;N # <control> +0086;N # <control> +0087;N # <control> +0088;N # <control> +0089;N # <control> +008A;N # <control> +008B;N # <control> +008C;N # <control> +008D;N # <control> +008E;N # <control> +008F;N # <control> +0090;N # <control> +0091;N # <control> +0092;N # <control> +0093;N # <control> +0094;N # <control> +0095;N # <control> +0096;N # <control> +0097;N # <control> +0098;N # <control> +0099;N # <control> +009A;N # <control> +009B;N # <control> +009C;N # <control> +009D;N # <control> +009E;N # <control> +009F;N # <control> +00A0;N # NO-BREAK SPACE +00A1;A # INVERTED EXCLAMATION MARK +00A2;Na # CENT SIGN +00A3;Na # POUND SIGN +00A4;A # CURRENCY SIGN +00A5;Na # YEN SIGN +00A6;Na # BROKEN BAR +00A7;A # SECTION SIGN +00A8;A # DIAERESIS +00A9;N # COPYRIGHT SIGN +00AA;A # FEMININE ORDINAL INDICATOR +00AB;N # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +00AC;Na # NOT SIGN +00AD;A # SOFT HYPHEN +00AE;A # REGISTERED SIGN +00AF;Na # MACRON +00B0;A # DEGREE SIGN +00B1;A # PLUS-MINUS SIGN +00B2;A # SUPERSCRIPT TWO +00B3;A # SUPERSCRIPT THREE +00B4;A # ACUTE ACCENT +00B5;N # MICRO SIGN +00B6;A # PILCROW SIGN +00B7;A # MIDDLE DOT +00B8;A # CEDILLA +00B9;A # SUPERSCRIPT ONE +00BA;A # MASCULINE ORDINAL INDICATOR +00BB;N # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +00BC;A # VULGAR FRACTION ONE QUARTER +00BD;A # VULGAR FRACTION ONE HALF +00BE;A # VULGAR FRACTION THREE QUARTERS +00BF;A # INVERTED QUESTION MARK +00C0;N # LATIN CAPITAL LETTER A WITH GRAVE +00C1;N # LATIN CAPITAL LETTER A WITH ACUTE +00C2;N # LATIN CAPITAL LETTER A WITH CIRCUMFLEX +00C3;N # LATIN CAPITAL LETTER A WITH TILDE +00C4;N # LATIN CAPITAL LETTER A WITH DIAERESIS +00C5;N # LATIN CAPITAL LETTER A WITH RING ABOVE +00C6;A # LATIN CAPITAL LETTER AE +00C7;N # LATIN CAPITAL LETTER C WITH CEDILLA +00C8;N # LATIN CAPITAL LETTER E WITH GRAVE +00C9;N # LATIN CAPITAL LETTER E WITH ACUTE +00CA;N # LATIN CAPITAL LETTER E WITH CIRCUMFLEX +00CB;N # LATIN CAPITAL LETTER E WITH DIAERESIS +00CC;N # LATIN CAPITAL LETTER I WITH GRAVE +00CD;N # LATIN CAPITAL LETTER I WITH ACUTE +00CE;N # LATIN CAPITAL LETTER I WITH CIRCUMFLEX +00CF;N # LATIN CAPITAL LETTER I WITH DIAERESIS +00D0;A # LATIN CAPITAL LETTER ETH +00D1;N # LATIN CAPITAL LETTER N WITH TILDE +00D2;N # LATIN CAPITAL LETTER O WITH GRAVE +00D3;N # LATIN CAPITAL LETTER O WITH ACUTE +00D4;N # LATIN CAPITAL LETTER O WITH CIRCUMFLEX +00D5;N # LATIN CAPITAL LETTER O WITH TILDE +00D6;N # LATIN CAPITAL LETTER O WITH DIAERESIS +00D7;A # MULTIPLICATION SIGN +00D8;A # LATIN CAPITAL LETTER O WITH STROKE +00D9;N # LATIN CAPITAL LETTER U WITH GRAVE +00DA;N # LATIN CAPITAL LETTER U WITH ACUTE +00DB;N # LATIN CAPITAL LETTER U WITH CIRCUMFLEX +00DC;N # LATIN CAPITAL LETTER U WITH DIAERESIS +00DD;N # LATIN CAPITAL LETTER Y WITH ACUTE +00DE;A # LATIN CAPITAL LETTER THORN +00DF;A # LATIN SMALL LETTER SHARP S +00E0;A # LATIN SMALL LETTER A WITH GRAVE +00E1;A # LATIN SMALL LETTER A WITH ACUTE +00E2;N # LATIN SMALL LETTER A WITH CIRCUMFLEX +00E3;N # LATIN SMALL LETTER A WITH TILDE +00E4;N # LATIN SMALL LETTER A WITH DIAERESIS +00E5;N # LATIN SMALL LETTER A WITH RING ABOVE +00E6;A # LATIN SMALL LETTER AE +00E7;N # LATIN SMALL LETTER C WITH CEDILLA +00E8;A # LATIN SMALL LETTER E WITH GRAVE +00E9;A # LATIN SMALL LETTER E WITH ACUTE +00EA;A # LATIN SMALL LETTER E WITH CIRCUMFLEX +00EB;N # LATIN SMALL LETTER E WITH DIAERESIS +00EC;A # LATIN SMALL LETTER I WITH GRAVE +00ED;A # LATIN SMALL LETTER I WITH ACUTE +00EE;N # LATIN SMALL LETTER I WITH CIRCUMFLEX +00EF;N # LATIN SMALL LETTER I WITH DIAERESIS +00F0;A # LATIN SMALL LETTER ETH +00F1;N # LATIN SMALL LETTER N WITH TILDE +00F2;A # LATIN SMALL LETTER O WITH GRAVE +00F3;A # LATIN SMALL LETTER O WITH ACUTE +00F4;N # LATIN SMALL LETTER O WITH CIRCUMFLEX +00F5;N # LATIN SMALL LETTER O WITH TILDE +00F6;N # LATIN SMALL LETTER O WITH DIAERESIS +00F7;A # DIVISION SIGN +00F8;A # LATIN SMALL LETTER O WITH STROKE +00F9;A # LATIN SMALL LETTER U WITH GRAVE +00FA;A # LATIN SMALL LETTER U WITH ACUTE +00FB;N # LATIN SMALL LETTER U WITH CIRCUMFLEX +00FC;A # LATIN SMALL LETTER U WITH DIAERESIS +00FD;N # LATIN SMALL LETTER Y WITH ACUTE +00FE;A # LATIN SMALL LETTER THORN +00FF;N # LATIN SMALL LETTER Y WITH DIAERESIS +0100;N # LATIN CAPITAL LETTER A WITH MACRON +0101;A # LATIN SMALL LETTER A WITH MACRON +0102;N # LATIN CAPITAL LETTER A WITH BREVE +0103;N # LATIN SMALL LETTER A WITH BREVE +0104;N # LATIN CAPITAL LETTER A WITH OGONEK +0105;N # LATIN SMALL LETTER A WITH OGONEK +0106;N # LATIN CAPITAL LETTER C WITH ACUTE +0107;N # LATIN SMALL LETTER C WITH ACUTE +0108;N # LATIN CAPITAL LETTER C WITH CIRCUMFLEX +0109;N # LATIN SMALL LETTER C WITH CIRCUMFLEX +010A;N # LATIN CAPITAL LETTER C WITH DOT ABOVE +010B;N # LATIN SMALL LETTER C WITH DOT ABOVE +010C;N # LATIN CAPITAL LETTER C WITH CARON +010D;N # LATIN SMALL LETTER C WITH CARON +010E;N # LATIN CAPITAL LETTER D WITH CARON +010F;N # LATIN SMALL LETTER D WITH CARON +0110;N # LATIN CAPITAL LETTER D WITH STROKE +0111;A # LATIN SMALL LETTER D WITH STROKE +0112;N # LATIN CAPITAL LETTER E WITH MACRON +0113;A # LATIN SMALL LETTER E WITH MACRON +0114;N # LATIN CAPITAL LETTER E WITH BREVE +0115;N # LATIN SMALL LETTER E WITH BREVE +0116;N # LATIN CAPITAL LETTER E WITH DOT ABOVE +0117;N # LATIN SMALL LETTER E WITH DOT ABOVE +0118;N # LATIN CAPITAL LETTER E WITH OGONEK +0119;N # LATIN SMALL LETTER E WITH OGONEK +011A;N # LATIN CAPITAL LETTER E WITH CARON +011B;A # LATIN SMALL LETTER E WITH CARON +011C;N # LATIN CAPITAL LETTER G WITH CIRCUMFLEX +011D;N # LATIN SMALL LETTER G WITH CIRCUMFLEX +011E;N # LATIN CAPITAL LETTER G WITH BREVE +011F;N # LATIN SMALL LETTER G WITH BREVE +0120;N # LATIN CAPITAL LETTER G WITH DOT ABOVE +0121;N # LATIN SMALL LETTER G WITH DOT ABOVE +0122;N # LATIN CAPITAL LETTER G WITH CEDILLA +0123;N # LATIN SMALL LETTER G WITH CEDILLA +0124;N # LATIN CAPITAL LETTER H WITH CIRCUMFLEX +0125;N # LATIN SMALL LETTER H WITH CIRCUMFLEX +0126;A # LATIN CAPITAL LETTER H WITH STROKE +0127;A # LATIN SMALL LETTER H WITH STROKE +0128;N # LATIN CAPITAL LETTER I WITH TILDE +0129;N # LATIN SMALL LETTER I WITH TILDE +012A;N # LATIN CAPITAL LETTER I WITH MACRON +012B;A # LATIN SMALL LETTER I WITH MACRON +012C;N # LATIN CAPITAL LETTER I WITH BREVE +012D;N # LATIN SMALL LETTER I WITH BREVE +012E;N # LATIN CAPITAL LETTER I WITH OGONEK +012F;N # LATIN SMALL LETTER I WITH OGONEK +0130;N # LATIN CAPITAL LETTER I WITH DOT ABOVE +0131;A # LATIN SMALL LETTER DOTLESS I +0132;A # LATIN CAPITAL LIGATURE IJ +0133;A # LATIN SMALL LIGATURE IJ +0134;N # LATIN CAPITAL LETTER J WITH CIRCUMFLEX +0135;N # LATIN SMALL LETTER J WITH CIRCUMFLEX +0136;N # LATIN CAPITAL LETTER K WITH CEDILLA +0137;N # LATIN SMALL LETTER K WITH CEDILLA +0138;A # LATIN SMALL LETTER KRA +0139;N # LATIN CAPITAL LETTER L WITH ACUTE +013A;N # LATIN SMALL LETTER L WITH ACUTE +013B;N # LATIN CAPITAL LETTER L WITH CEDILLA +013C;N # LATIN SMALL LETTER L WITH CEDILLA +013D;N # LATIN CAPITAL LETTER L WITH CARON +013E;N # LATIN SMALL LETTER L WITH CARON +013F;A # LATIN CAPITAL LETTER L WITH MIDDLE DOT +0140;A # LATIN SMALL LETTER L WITH MIDDLE DOT +0141;A # LATIN CAPITAL LETTER L WITH STROKE +0142;A # LATIN SMALL LETTER L WITH STROKE +0143;N # LATIN CAPITAL LETTER N WITH ACUTE +0144;A # LATIN SMALL LETTER N WITH ACUTE +0145;N # LATIN CAPITAL LETTER N WITH CEDILLA +0146;N # LATIN SMALL LETTER N WITH CEDILLA +0147;N # LATIN CAPITAL LETTER N WITH CARON +0148;A # LATIN SMALL LETTER N WITH CARON +0149;A # LATIN SMALL LETTER N PRECEDED BY APOSTROPHE +014A;A # LATIN CAPITAL LETTER ENG +014B;A # LATIN SMALL LETTER ENG +014C;N # LATIN CAPITAL LETTER O WITH MACRON +014D;A # LATIN SMALL LETTER O WITH MACRON +014E;N # LATIN CAPITAL LETTER O WITH BREVE +014F;N # LATIN SMALL LETTER O WITH BREVE +0150;N # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE +0151;N # LATIN SMALL LETTER O WITH DOUBLE ACUTE +0152;A # LATIN CAPITAL LIGATURE OE +0153;A # LATIN SMALL LIGATURE OE +0154;N # LATIN CAPITAL LETTER R WITH ACUTE +0155;N # LATIN SMALL LETTER R WITH ACUTE +0156;N # LATIN CAPITAL LETTER R WITH CEDILLA +0157;N # LATIN SMALL LETTER R WITH CEDILLA +0158;N # LATIN CAPITAL LETTER R WITH CARON +0159;N # LATIN SMALL LETTER R WITH CARON +015A;N # LATIN CAPITAL LETTER S WITH ACUTE +015B;N # LATIN SMALL LETTER S WITH ACUTE +015C;N # LATIN CAPITAL LETTER S WITH CIRCUMFLEX +015D;N # LATIN SMALL LETTER S WITH CIRCUMFLEX +015E;N # LATIN CAPITAL LETTER S WITH CEDILLA +015F;N # LATIN SMALL LETTER S WITH CEDILLA +0160;N # LATIN CAPITAL LETTER S WITH CARON +0161;N # LATIN SMALL LETTER S WITH CARON +0162;N # LATIN CAPITAL LETTER T WITH CEDILLA +0163;N # LATIN SMALL LETTER T WITH CEDILLA +0164;N # LATIN CAPITAL LETTER T WITH CARON +0165;N # LATIN SMALL LETTER T WITH CARON +0166;A # LATIN CAPITAL LETTER T WITH STROKE +0167;A # LATIN SMALL LETTER T WITH STROKE +0168;N # LATIN CAPITAL LETTER U WITH TILDE +0169;N # LATIN SMALL LETTER U WITH TILDE +016A;N # LATIN CAPITAL LETTER U WITH MACRON +016B;A # LATIN SMALL LETTER U WITH MACRON +016C;N # LATIN CAPITAL LETTER U WITH BREVE +016D;N # LATIN SMALL LETTER U WITH BREVE +016E;N # LATIN CAPITAL LETTER U WITH RING ABOVE +016F;N # LATIN SMALL LETTER U WITH RING ABOVE +0170;N # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE +0171;N # LATIN SMALL LETTER U WITH DOUBLE ACUTE +0172;N # LATIN CAPITAL LETTER U WITH OGONEK +0173;N # LATIN SMALL LETTER U WITH OGONEK +0174;N # LATIN CAPITAL LETTER W WITH CIRCUMFLEX +0175;N # LATIN SMALL LETTER W WITH CIRCUMFLEX +0176;N # LATIN CAPITAL LETTER Y WITH CIRCUMFLEX +0177;N # LATIN SMALL LETTER Y WITH CIRCUMFLEX +0178;N # LATIN CAPITAL LETTER Y WITH DIAERESIS +0179;N # LATIN CAPITAL LETTER Z WITH ACUTE +017A;N # LATIN SMALL LETTER Z WITH ACUTE +017B;N # LATIN CAPITAL LETTER Z WITH DOT ABOVE +017C;N # LATIN SMALL LETTER Z WITH DOT ABOVE +017D;N # LATIN CAPITAL LETTER Z WITH CARON +017E;N # LATIN SMALL LETTER Z WITH CARON +017F;N # LATIN SMALL LETTER LONG S +0180;N # LATIN SMALL LETTER B WITH STROKE +0181;N # LATIN CAPITAL LETTER B WITH HOOK +0182;N # LATIN CAPITAL LETTER B WITH TOPBAR +0183;N # LATIN SMALL LETTER B WITH TOPBAR +0184;N # LATIN CAPITAL LETTER TONE SIX +0185;N # LATIN SMALL LETTER TONE SIX +0186;N # LATIN CAPITAL LETTER OPEN O +0187;N # LATIN CAPITAL LETTER C WITH HOOK +0188;N # LATIN SMALL LETTER C WITH HOOK +0189;N # LATIN CAPITAL LETTER AFRICAN D +018A;N # LATIN CAPITAL LETTER D WITH HOOK +018B;N # LATIN CAPITAL LETTER D WITH TOPBAR +018C;N # LATIN SMALL LETTER D WITH TOPBAR +018D;N # LATIN SMALL LETTER TURNED DELTA +018E;N # LATIN CAPITAL LETTER REVERSED E +018F;N # LATIN CAPITAL LETTER SCHWA +0190;N # LATIN CAPITAL LETTER OPEN E +0191;N # LATIN CAPITAL LETTER F WITH HOOK +0192;N # LATIN SMALL LETTER F WITH HOOK +0193;N # LATIN CAPITAL LETTER G WITH HOOK +0194;N # LATIN CAPITAL LETTER GAMMA +0195;N # LATIN SMALL LETTER HV +0196;N # LATIN CAPITAL LETTER IOTA +0197;N # LATIN CAPITAL LETTER I WITH STROKE +0198;N # LATIN CAPITAL LETTER K WITH HOOK +0199;N # LATIN SMALL LETTER K WITH HOOK +019A;N # LATIN SMALL LETTER L WITH BAR +019B;N # LATIN SMALL LETTER LAMBDA WITH STROKE +019C;N # LATIN CAPITAL LETTER TURNED M +019D;N # LATIN CAPITAL LETTER N WITH LEFT HOOK +019E;N # LATIN SMALL LETTER N WITH LONG RIGHT LEG +019F;N # LATIN CAPITAL LETTER O WITH MIDDLE TILDE +01A0;N # LATIN CAPITAL LETTER O WITH HORN +01A1;N # LATIN SMALL LETTER O WITH HORN +01A2;N # LATIN CAPITAL LETTER OI +01A3;N # LATIN SMALL LETTER OI +01A4;N # LATIN CAPITAL LETTER P WITH HOOK +01A5;N # LATIN SMALL LETTER P WITH HOOK +01A6;N # LATIN LETTER YR +01A7;N # LATIN CAPITAL LETTER TONE TWO +01A8;N # LATIN SMALL LETTER TONE TWO +01A9;N # LATIN CAPITAL LETTER ESH +01AA;N # LATIN LETTER REVERSED ESH LOOP +01AB;N # LATIN SMALL LETTER T WITH PALATAL HOOK +01AC;N # LATIN CAPITAL LETTER T WITH HOOK +01AD;N # LATIN SMALL LETTER T WITH HOOK +01AE;N # LATIN CAPITAL LETTER T WITH RETROFLEX HOOK +01AF;N # LATIN CAPITAL LETTER U WITH HORN +01B0;N # LATIN SMALL LETTER U WITH HORN +01B1;N # LATIN CAPITAL LETTER UPSILON +01B2;N # LATIN CAPITAL LETTER V WITH HOOK +01B3;N # LATIN CAPITAL LETTER Y WITH HOOK +01B4;N # LATIN SMALL LETTER Y WITH HOOK +01B5;N # LATIN CAPITAL LETTER Z WITH STROKE +01B6;N # LATIN SMALL LETTER Z WITH STROKE +01B7;N # LATIN CAPITAL LETTER EZH +01B8;N # LATIN CAPITAL LETTER EZH REVERSED +01B9;N # LATIN SMALL LETTER EZH REVERSED +01BA;N # LATIN SMALL LETTER EZH WITH TAIL +01BB;N # LATIN LETTER TWO WITH STROKE +01BC;N # LATIN CAPITAL LETTER TONE FIVE +01BD;N # LATIN SMALL LETTER TONE FIVE +01BE;N # LATIN LETTER INVERTED GLOTTAL STOP WITH STROKE +01BF;N # LATIN LETTER WYNN +01C0;N # LATIN LETTER DENTAL CLICK +01C1;N # LATIN LETTER LATERAL CLICK +01C2;N # LATIN LETTER ALVEOLAR CLICK +01C3;N # LATIN LETTER RETROFLEX CLICK +01C4;N # LATIN CAPITAL LETTER DZ WITH CARON +01C5;N # LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON +01C6;N # LATIN SMALL LETTER DZ WITH CARON +01C7;N # LATIN CAPITAL LETTER LJ +01C8;N # LATIN CAPITAL LETTER L WITH SMALL LETTER J +01C9;N # LATIN SMALL LETTER LJ +01CA;N # LATIN CAPITAL LETTER NJ +01CB;N # LATIN CAPITAL LETTER N WITH SMALL LETTER J +01CC;N # LATIN SMALL LETTER NJ +01CD;N # LATIN CAPITAL LETTER A WITH CARON +01CE;A # LATIN SMALL LETTER A WITH CARON +01CF;N # LATIN CAPITAL LETTER I WITH CARON +01D0;A # LATIN SMALL LETTER I WITH CARON +01D1;N # LATIN CAPITAL LETTER O WITH CARON +01D2;A # LATIN SMALL LETTER O WITH CARON +01D3;N # LATIN CAPITAL LETTER U WITH CARON +01D4;A # LATIN SMALL LETTER U WITH CARON +01D5;N # LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON +01D6;A # LATIN SMALL LETTER U WITH DIAERESIS AND MACRON +01D7;N # LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE +01D8;A # LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE +01D9;N # LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON +01DA;A # LATIN SMALL LETTER U WITH DIAERESIS AND CARON +01DB;N # LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE +01DC;A # LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE +01DD;N # LATIN SMALL LETTER TURNED E +01DE;N # LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON +01DF;N # LATIN SMALL LETTER A WITH DIAERESIS AND MACRON +01E0;N # LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON +01E1;N # LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON +01E2;N # LATIN CAPITAL LETTER AE WITH MACRON +01E3;N # LATIN SMALL LETTER AE WITH MACRON +01E4;N # LATIN CAPITAL LETTER G WITH STROKE +01E5;N # LATIN SMALL LETTER G WITH STROKE +01E6;N # LATIN CAPITAL LETTER G WITH CARON +01E7;N # LATIN SMALL LETTER G WITH CARON +01E8;N # LATIN CAPITAL LETTER K WITH CARON +01E9;N # LATIN SMALL LETTER K WITH CARON +01EA;N # LATIN CAPITAL LETTER O WITH OGONEK +01EB;N # LATIN SMALL LETTER O WITH OGONEK +01EC;N # LATIN CAPITAL LETTER O WITH OGONEK AND MACRON +01ED;N # LATIN SMALL LETTER O WITH OGONEK AND MACRON +01EE;N # LATIN CAPITAL LETTER EZH WITH CARON +01EF;N # LATIN SMALL LETTER EZH WITH CARON +01F0;N # LATIN SMALL LETTER J WITH CARON +01F1;N # LATIN CAPITAL LETTER DZ +01F2;N # LATIN CAPITAL LETTER D WITH SMALL LETTER Z +01F3;N # LATIN SMALL LETTER DZ +01F4;N # LATIN CAPITAL LETTER G WITH ACUTE +01F5;N # LATIN SMALL LETTER G WITH ACUTE +01F6;N # LATIN CAPITAL LETTER HWAIR +01F7;N # LATIN CAPITAL LETTER WYNN +01F8;N # LATIN CAPITAL LETTER N WITH GRAVE +01F9;N # LATIN SMALL LETTER N WITH GRAVE +01FA;N # LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE +01FB;N # LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE +01FC;N # LATIN CAPITAL LETTER AE WITH ACUTE +01FD;N # LATIN SMALL LETTER AE WITH ACUTE +01FE;N # LATIN CAPITAL LETTER O WITH STROKE AND ACUTE +01FF;N # LATIN SMALL LETTER O WITH STROKE AND ACUTE +0200;N # LATIN CAPITAL LETTER A WITH DOUBLE GRAVE +0201;N # LATIN SMALL LETTER A WITH DOUBLE GRAVE +0202;N # LATIN CAPITAL LETTER A WITH INVERTED BREVE +0203;N # LATIN SMALL LETTER A WITH INVERTED BREVE +0204;N # LATIN CAPITAL LETTER E WITH DOUBLE GRAVE +0205;N # LATIN SMALL LETTER E WITH DOUBLE GRAVE +0206;N # LATIN CAPITAL LETTER E WITH INVERTED BREVE +0207;N # LATIN SMALL LETTER E WITH INVERTED BREVE +0208;N # LATIN CAPITAL LETTER I WITH DOUBLE GRAVE +0209;N # LATIN SMALL LETTER I WITH DOUBLE GRAVE +020A;N # LATIN CAPITAL LETTER I WITH INVERTED BREVE +020B;N # LATIN SMALL LETTER I WITH INVERTED BREVE +020C;N # LATIN CAPITAL LETTER O WITH DOUBLE GRAVE +020D;N # LATIN SMALL LETTER O WITH DOUBLE GRAVE +020E;N # LATIN CAPITAL LETTER O WITH INVERTED BREVE +020F;N # LATIN SMALL LETTER O WITH INVERTED BREVE +0210;N # LATIN CAPITAL LETTER R WITH DOUBLE GRAVE +0211;N # LATIN SMALL LETTER R WITH DOUBLE GRAVE +0212;N # LATIN CAPITAL LETTER R WITH INVERTED BREVE +0213;N # LATIN SMALL LETTER R WITH INVERTED BREVE +0214;N # LATIN CAPITAL LETTER U WITH DOUBLE GRAVE +0215;N # LATIN SMALL LETTER U WITH DOUBLE GRAVE +0216;N # LATIN CAPITAL LETTER U WITH INVERTED BREVE +0217;N # LATIN SMALL LETTER U WITH INVERTED BREVE +0218;N # LATIN CAPITAL LETTER S WITH COMMA BELOW +0219;N # LATIN SMALL LETTER S WITH COMMA BELOW +021A;N # LATIN CAPITAL LETTER T WITH COMMA BELOW +021B;N # LATIN SMALL LETTER T WITH COMMA BELOW +021C;N # LATIN CAPITAL LETTER YOGH +021D;N # LATIN SMALL LETTER YOGH +021E;N # LATIN CAPITAL LETTER H WITH CARON +021F;N # LATIN SMALL LETTER H WITH CARON +0220;N # LATIN CAPITAL LETTER N WITH LONG RIGHT LEG +0221;N # LATIN SMALL LETTER D WITH CURL +0222;N # LATIN CAPITAL LETTER OU +0223;N # LATIN SMALL LETTER OU +0224;N # LATIN CAPITAL LETTER Z WITH HOOK +0225;N # LATIN SMALL LETTER Z WITH HOOK +0226;N # LATIN CAPITAL LETTER A WITH DOT ABOVE +0227;N # LATIN SMALL LETTER A WITH DOT ABOVE +0228;N # LATIN CAPITAL LETTER E WITH CEDILLA +0229;N # LATIN SMALL LETTER E WITH CEDILLA +022A;N # LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON +022B;N # LATIN SMALL LETTER O WITH DIAERESIS AND MACRON +022C;N # LATIN CAPITAL LETTER O WITH TILDE AND MACRON +022D;N # LATIN SMALL LETTER O WITH TILDE AND MACRON +022E;N # LATIN CAPITAL LETTER O WITH DOT ABOVE +022F;N # LATIN SMALL LETTER O WITH DOT ABOVE +0230;N # LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON +0231;N # LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON +0232;N # LATIN CAPITAL LETTER Y WITH MACRON +0233;N # LATIN SMALL LETTER Y WITH MACRON +0234;N # LATIN SMALL LETTER L WITH CURL +0235;N # LATIN SMALL LETTER N WITH CURL +0236;N # LATIN SMALL LETTER T WITH CURL +0237;N # LATIN SMALL LETTER DOTLESS J +0238;N # LATIN SMALL LETTER DB DIGRAPH +0239;N # LATIN SMALL LETTER QP DIGRAPH +023A;N # LATIN CAPITAL LETTER A WITH STROKE +023B;N # LATIN CAPITAL LETTER C WITH STROKE +023C;N # LATIN SMALL LETTER C WITH STROKE +023D;N # LATIN CAPITAL LETTER L WITH BAR +023E;N # LATIN CAPITAL LETTER T WITH DIAGONAL STROKE +023F;N # LATIN SMALL LETTER S WITH SWASH TAIL +0240;N # LATIN SMALL LETTER Z WITH SWASH TAIL +0241;N # LATIN CAPITAL LETTER GLOTTAL STOP +0250;N # LATIN SMALL LETTER TURNED A +0251;A # LATIN SMALL LETTER ALPHA +0252;N # LATIN SMALL LETTER TURNED ALPHA +0253;N # LATIN SMALL LETTER B WITH HOOK +0254;N # LATIN SMALL LETTER OPEN O +0255;N # LATIN SMALL LETTER C WITH CURL +0256;N # LATIN SMALL LETTER D WITH TAIL +0257;N # LATIN SMALL LETTER D WITH HOOK +0258;N # LATIN SMALL LETTER REVERSED E +0259;N # LATIN SMALL LETTER SCHWA +025A;N # LATIN SMALL LETTER SCHWA WITH HOOK +025B;N # LATIN SMALL LETTER OPEN E +025C;N # LATIN SMALL LETTER REVERSED OPEN E +025D;N # LATIN SMALL LETTER REVERSED OPEN E WITH HOOK +025E;N # LATIN SMALL LETTER CLOSED REVERSED OPEN E +025F;N # LATIN SMALL LETTER DOTLESS J WITH STROKE +0260;N # LATIN SMALL LETTER G WITH HOOK +0261;A # LATIN SMALL LETTER SCRIPT G +0262;N # LATIN LETTER SMALL CAPITAL G +0263;N # LATIN SMALL LETTER GAMMA +0264;N # LATIN SMALL LETTER RAMS HORN +0265;N # LATIN SMALL LETTER TURNED H +0266;N # LATIN SMALL LETTER H WITH HOOK +0267;N # LATIN SMALL LETTER HENG WITH HOOK +0268;N # LATIN SMALL LETTER I WITH STROKE +0269;N # LATIN SMALL LETTER IOTA +026A;N # LATIN LETTER SMALL CAPITAL I +026B;N # LATIN SMALL LETTER L WITH MIDDLE TILDE +026C;N # LATIN SMALL LETTER L WITH BELT +026D;N # LATIN SMALL LETTER L WITH RETROFLEX HOOK +026E;N # LATIN SMALL LETTER LEZH +026F;N # LATIN SMALL LETTER TURNED M +0270;N # LATIN SMALL LETTER TURNED M WITH LONG LEG +0271;N # LATIN SMALL LETTER M WITH HOOK +0272;N # LATIN SMALL LETTER N WITH LEFT HOOK +0273;N # LATIN SMALL LETTER N WITH RETROFLEX HOOK +0274;N # LATIN LETTER SMALL CAPITAL N +0275;N # LATIN SMALL LETTER BARRED O +0276;N # LATIN LETTER SMALL CAPITAL OE +0277;N # LATIN SMALL LETTER CLOSED OMEGA +0278;N # LATIN SMALL LETTER PHI +0279;N # LATIN SMALL LETTER TURNED R +027A;N # LATIN SMALL LETTER TURNED R WITH LONG LEG +027B;N # LATIN SMALL LETTER TURNED R WITH HOOK +027C;N # LATIN SMALL LETTER R WITH LONG LEG +027D;N # LATIN SMALL LETTER R WITH TAIL +027E;N # LATIN SMALL LETTER R WITH FISHHOOK +027F;N # LATIN SMALL LETTER REVERSED R WITH FISHHOOK +0280;N # LATIN LETTER SMALL CAPITAL R +0281;N # LATIN LETTER SMALL CAPITAL INVERTED R +0282;N # LATIN SMALL LETTER S WITH HOOK +0283;N # LATIN SMALL LETTER ESH +0284;N # LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK +0285;N # LATIN SMALL LETTER SQUAT REVERSED ESH +0286;N # LATIN SMALL LETTER ESH WITH CURL +0287;N # LATIN SMALL LETTER TURNED T +0288;N # LATIN SMALL LETTER T WITH RETROFLEX HOOK +0289;N # LATIN SMALL LETTER U BAR +028A;N # LATIN SMALL LETTER UPSILON +028B;N # LATIN SMALL LETTER V WITH HOOK +028C;N # LATIN SMALL LETTER TURNED V +028D;N # LATIN SMALL LETTER TURNED W +028E;N # LATIN SMALL LETTER TURNED Y +028F;N # LATIN LETTER SMALL CAPITAL Y +0290;N # LATIN SMALL LETTER Z WITH RETROFLEX HOOK +0291;N # LATIN SMALL LETTER Z WITH CURL +0292;N # LATIN SMALL LETTER EZH +0293;N # LATIN SMALL LETTER EZH WITH CURL +0294;N # LATIN LETTER GLOTTAL STOP +0295;N # LATIN LETTER PHARYNGEAL VOICED FRICATIVE +0296;N # LATIN LETTER INVERTED GLOTTAL STOP +0297;N # LATIN LETTER STRETCHED C +0298;N # LATIN LETTER BILABIAL CLICK +0299;N # LATIN LETTER SMALL CAPITAL B +029A;N # LATIN SMALL LETTER CLOSED OPEN E +029B;N # LATIN LETTER SMALL CAPITAL G WITH HOOK +029C;N # LATIN LETTER SMALL CAPITAL H +029D;N # LATIN SMALL LETTER J WITH CROSSED-TAIL +029E;N # LATIN SMALL LETTER TURNED K +029F;N # LATIN LETTER SMALL CAPITAL L +02A0;N # LATIN SMALL LETTER Q WITH HOOK +02A1;N # LATIN LETTER GLOTTAL STOP WITH STROKE +02A2;N # LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE +02A3;N # LATIN SMALL LETTER DZ DIGRAPH +02A4;N # LATIN SMALL LETTER DEZH DIGRAPH +02A5;N # LATIN SMALL LETTER DZ DIGRAPH WITH CURL +02A6;N # LATIN SMALL LETTER TS DIGRAPH +02A7;N # LATIN SMALL LETTER TESH DIGRAPH +02A8;N # LATIN SMALL LETTER TC DIGRAPH WITH CURL +02A9;N # LATIN SMALL LETTER FENG DIGRAPH +02AA;N # LATIN SMALL LETTER LS DIGRAPH +02AB;N # LATIN SMALL LETTER LZ DIGRAPH +02AC;N # LATIN LETTER BILABIAL PERCUSSIVE +02AD;N # LATIN LETTER BIDENTAL PERCUSSIVE +02AE;N # LATIN SMALL LETTER TURNED H WITH FISHHOOK +02AF;N # LATIN SMALL LETTER TURNED H WITH FISHHOOK AND TAIL +02B0;N # MODIFIER LETTER SMALL H +02B1;N # MODIFIER LETTER SMALL H WITH HOOK +02B2;N # MODIFIER LETTER SMALL J +02B3;N # MODIFIER LETTER SMALL R +02B4;N # MODIFIER LETTER SMALL TURNED R +02B5;N # MODIFIER LETTER SMALL TURNED R WITH HOOK +02B6;N # MODIFIER LETTER SMALL CAPITAL INVERTED R +02B7;N # MODIFIER LETTER SMALL W +02B8;N # MODIFIER LETTER SMALL Y +02B9;N # MODIFIER LETTER PRIME +02BA;N # MODIFIER LETTER DOUBLE PRIME +02BB;N # MODIFIER LETTER TURNED COMMA +02BC;N # MODIFIER LETTER APOSTROPHE +02BD;N # MODIFIER LETTER REVERSED COMMA +02BE;N # MODIFIER LETTER RIGHT HALF RING +02BF;N # MODIFIER LETTER LEFT HALF RING +02C0;N # MODIFIER LETTER GLOTTAL STOP +02C1;N # MODIFIER LETTER REVERSED GLOTTAL STOP +02C2;N # MODIFIER LETTER LEFT ARROWHEAD +02C3;N # MODIFIER LETTER RIGHT ARROWHEAD +02C4;A # MODIFIER LETTER UP ARROWHEAD +02C5;N # MODIFIER LETTER DOWN ARROWHEAD +02C6;N # MODIFIER LETTER CIRCUMFLEX ACCENT +02C7;A # CARON +02C8;N # MODIFIER LETTER VERTICAL LINE +02C9;A # MODIFIER LETTER MACRON +02CA;A # MODIFIER LETTER ACUTE ACCENT +02CB;A # MODIFIER LETTER GRAVE ACCENT +02CC;N # MODIFIER LETTER LOW VERTICAL LINE +02CD;A # MODIFIER LETTER LOW MACRON +02CE;N # MODIFIER LETTER LOW GRAVE ACCENT +02CF;N # MODIFIER LETTER LOW ACUTE ACCENT +02D0;A # MODIFIER LETTER TRIANGULAR COLON +02D1;N # MODIFIER LETTER HALF TRIANGULAR COLON +02D2;N # MODIFIER LETTER CENTRED RIGHT HALF RING +02D3;N # MODIFIER LETTER CENTRED LEFT HALF RING +02D4;N # MODIFIER LETTER UP TACK +02D5;N # MODIFIER LETTER DOWN TACK +02D6;N # MODIFIER LETTER PLUS SIGN +02D7;N # MODIFIER LETTER MINUS SIGN +02D8;A # BREVE +02D9;A # DOT ABOVE +02DA;A # RING ABOVE +02DB;A # OGONEK +02DC;N # SMALL TILDE +02DD;A # DOUBLE ACUTE ACCENT +02DE;N # MODIFIER LETTER RHOTIC HOOK +02DF;A # MODIFIER LETTER CROSS ACCENT +02E0;N # MODIFIER LETTER SMALL GAMMA +02E1;N # MODIFIER LETTER SMALL L +02E2;N # MODIFIER LETTER SMALL S +02E3;N # MODIFIER LETTER SMALL X +02E4;N # MODIFIER LETTER SMALL REVERSED GLOTTAL STOP +02E5;N # MODIFIER LETTER EXTRA-HIGH TONE BAR +02E6;N # MODIFIER LETTER HIGH TONE BAR +02E7;N # MODIFIER LETTER MID TONE BAR +02E8;N # MODIFIER LETTER LOW TONE BAR +02E9;N # MODIFIER LETTER EXTRA-LOW TONE BAR +02EA;N # MODIFIER LETTER YIN DEPARTING TONE MARK +02EB;N # MODIFIER LETTER YANG DEPARTING TONE MARK +02EC;N # MODIFIER LETTER VOICING +02ED;N # MODIFIER LETTER UNASPIRATED +02EE;N # MODIFIER LETTER DOUBLE APOSTROPHE +02EF;N # MODIFIER LETTER LOW DOWN ARROWHEAD +02F0;N # MODIFIER LETTER LOW UP ARROWHEAD +02F1;N # MODIFIER LETTER LOW LEFT ARROWHEAD +02F2;N # MODIFIER LETTER LOW RIGHT ARROWHEAD +02F3;N # MODIFIER LETTER LOW RING +02F4;N # MODIFIER LETTER MIDDLE GRAVE ACCENT +02F5;N # MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT +02F6;N # MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT +02F7;N # MODIFIER LETTER LOW TILDE +02F8;N # MODIFIER LETTER RAISED COLON +02F9;N # MODIFIER LETTER BEGIN HIGH TONE +02FA;N # MODIFIER LETTER END HIGH TONE +02FB;N # MODIFIER LETTER BEGIN LOW TONE +02FC;N # MODIFIER LETTER END LOW TONE +02FD;N # MODIFIER LETTER SHELF +02FE;N # MODIFIER LETTER OPEN SHELF +02FF;N # MODIFIER LETTER LOW LEFT ARROW +0300;A # COMBINING GRAVE ACCENT +0301;A # COMBINING ACUTE ACCENT +0302;A # COMBINING CIRCUMFLEX ACCENT +0303;A # COMBINING TILDE +0304;A # COMBINING MACRON +0305;A # COMBINING OVERLINE +0306;A # COMBINING BREVE +0307;A # COMBINING DOT ABOVE +0308;A # COMBINING DIAERESIS +0309;A # COMBINING HOOK ABOVE +030A;A # COMBINING RING ABOVE +030B;A # COMBINING DOUBLE ACUTE ACCENT +030C;A # COMBINING CARON +030D;A # COMBINING VERTICAL LINE ABOVE +030E;A # COMBINING DOUBLE VERTICAL LINE ABOVE +030F;A # COMBINING DOUBLE GRAVE ACCENT +0310;A # COMBINING CANDRABINDU +0311;A # COMBINING INVERTED BREVE +0312;A # COMBINING TURNED COMMA ABOVE +0313;A # COMBINING COMMA ABOVE +0314;A # COMBINING REVERSED COMMA ABOVE +0315;A # COMBINING COMMA ABOVE RIGHT +0316;A # COMBINING GRAVE ACCENT BELOW +0317;A # COMBINING ACUTE ACCENT BELOW +0318;A # COMBINING LEFT TACK BELOW +0319;A # COMBINING RIGHT TACK BELOW +031A;A # COMBINING LEFT ANGLE ABOVE +031B;A # COMBINING HORN +031C;A # COMBINING LEFT HALF RING BELOW +031D;A # COMBINING UP TACK BELOW +031E;A # COMBINING DOWN TACK BELOW +031F;A # COMBINING PLUS SIGN BELOW +0320;A # COMBINING MINUS SIGN BELOW +0321;A # COMBINING PALATALIZED HOOK BELOW +0322;A # COMBINING RETROFLEX HOOK BELOW +0323;A # COMBINING DOT BELOW +0324;A # COMBINING DIAERESIS BELOW +0325;A # COMBINING RING BELOW +0326;A # COMBINING COMMA BELOW +0327;A # COMBINING CEDILLA +0328;A # COMBINING OGONEK +0329;A # COMBINING VERTICAL LINE BELOW +032A;A # COMBINING BRIDGE BELOW +032B;A # COMBINING INVERTED DOUBLE ARCH BELOW +032C;A # COMBINING CARON BELOW +032D;A # COMBINING CIRCUMFLEX ACCENT BELOW +032E;A # COMBINING BREVE BELOW +032F;A # COMBINING INVERTED BREVE BELOW +0330;A # COMBINING TILDE BELOW +0331;A # COMBINING MACRON BELOW +0332;A # COMBINING LOW LINE +0333;A # COMBINING DOUBLE LOW LINE +0334;A # COMBINING TILDE OVERLAY +0335;A # COMBINING SHORT STROKE OVERLAY +0336;A # COMBINING LONG STROKE OVERLAY +0337;A # COMBINING SHORT SOLIDUS OVERLAY +0338;A # COMBINING LONG SOLIDUS OVERLAY +0339;A # COMBINING RIGHT HALF RING BELOW +033A;A # COMBINING INVERTED BRIDGE BELOW +033B;A # COMBINING SQUARE BELOW +033C;A # COMBINING SEAGULL BELOW +033D;A # COMBINING X ABOVE +033E;A # COMBINING VERTICAL TILDE +033F;A # COMBINING DOUBLE OVERLINE +0340;A # COMBINING GRAVE TONE MARK +0341;A # COMBINING ACUTE TONE MARK +0342;A # COMBINING GREEK PERISPOMENI +0343;A # COMBINING GREEK KORONIS +0344;A # COMBINING GREEK DIALYTIKA TONOS +0345;A # COMBINING GREEK YPOGEGRAMMENI +0346;A # COMBINING BRIDGE ABOVE +0347;A # COMBINING EQUALS SIGN BELOW +0348;A # COMBINING DOUBLE VERTICAL LINE BELOW +0349;A # COMBINING LEFT ANGLE BELOW +034A;A # COMBINING NOT TILDE ABOVE +034B;A # COMBINING HOMOTHETIC ABOVE +034C;A # COMBINING ALMOST EQUAL TO ABOVE +034D;A # COMBINING LEFT RIGHT ARROW BELOW +034E;A # COMBINING UPWARDS ARROW BELOW +034F;A # COMBINING GRAPHEME JOINER +0350;A # COMBINING RIGHT ARROWHEAD ABOVE +0351;A # COMBINING LEFT HALF RING ABOVE +0352;A # COMBINING FERMATA +0353;A # COMBINING X BELOW +0354;A # COMBINING LEFT ARROWHEAD BELOW +0355;A # COMBINING RIGHT ARROWHEAD BELOW +0356;A # COMBINING RIGHT ARROWHEAD AND UP ARROWHEAD BELOW +0357;A # COMBINING RIGHT HALF RING ABOVE +0358;A # COMBINING DOT ABOVE RIGHT +0359;A # COMBINING ASTERISK BELOW +035A;A # COMBINING DOUBLE RING BELOW +035B;A # COMBINING ZIGZAG ABOVE +035C;A # COMBINING DOUBLE BREVE BELOW +035D;A # COMBINING DOUBLE BREVE +035E;A # COMBINING DOUBLE MACRON +035F;A # COMBINING DOUBLE MACRON BELOW +0360;A # COMBINING DOUBLE TILDE +0361;A # COMBINING DOUBLE INVERTED BREVE +0362;A # COMBINING DOUBLE RIGHTWARDS ARROW BELOW +0363;A # COMBINING LATIN SMALL LETTER A +0364;A # COMBINING LATIN SMALL LETTER E +0365;A # COMBINING LATIN SMALL LETTER I +0366;A # COMBINING LATIN SMALL LETTER O +0367;A # COMBINING LATIN SMALL LETTER U +0368;A # COMBINING LATIN SMALL LETTER C +0369;A # COMBINING LATIN SMALL LETTER D +036A;A # COMBINING LATIN SMALL LETTER H +036B;A # COMBINING LATIN SMALL LETTER M +036C;A # COMBINING LATIN SMALL LETTER R +036D;A # COMBINING LATIN SMALL LETTER T +036E;A # COMBINING LATIN SMALL LETTER V +036F;A # COMBINING LATIN SMALL LETTER X +0374;N # GREEK NUMERAL SIGN +0375;N # GREEK LOWER NUMERAL SIGN +037A;N # GREEK YPOGEGRAMMENI +037E;N # GREEK QUESTION MARK +0384;N # GREEK TONOS +0385;N # GREEK DIALYTIKA TONOS +0386;N # GREEK CAPITAL LETTER ALPHA WITH TONOS +0387;N # GREEK ANO TELEIA +0388;N # GREEK CAPITAL LETTER EPSILON WITH TONOS +0389;N # GREEK CAPITAL LETTER ETA WITH TONOS +038A;N # GREEK CAPITAL LETTER IOTA WITH TONOS +038C;N # GREEK CAPITAL LETTER OMICRON WITH TONOS +038E;N # GREEK CAPITAL LETTER UPSILON WITH TONOS +038F;N # GREEK CAPITAL LETTER OMEGA WITH TONOS +0390;N # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS +0391;A # GREEK CAPITAL LETTER ALPHA +0392;A # GREEK CAPITAL LETTER BETA +0393;A # GREEK CAPITAL LETTER GAMMA +0394;A # GREEK CAPITAL LETTER DELTA +0395;A # GREEK CAPITAL LETTER EPSILON +0396;A # GREEK CAPITAL LETTER ZETA +0397;A # GREEK CAPITAL LETTER ETA +0398;A # GREEK CAPITAL LETTER THETA +0399;A # GREEK CAPITAL LETTER IOTA +039A;A # GREEK CAPITAL LETTER KAPPA +039B;A # GREEK CAPITAL LETTER LAMDA +039C;A # GREEK CAPITAL LETTER MU +039D;A # GREEK CAPITAL LETTER NU +039E;A # GREEK CAPITAL LETTER XI +039F;A # GREEK CAPITAL LETTER OMICRON +03A0;A # GREEK CAPITAL LETTER PI +03A1;A # GREEK CAPITAL LETTER RHO +03A3;A # GREEK CAPITAL LETTER SIGMA +03A4;A # GREEK CAPITAL LETTER TAU +03A5;A # GREEK CAPITAL LETTER UPSILON +03A6;A # GREEK CAPITAL LETTER PHI +03A7;A # GREEK CAPITAL LETTER CHI +03A8;A # GREEK CAPITAL LETTER PSI +03A9;A # GREEK CAPITAL LETTER OMEGA +03AA;N # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA +03AB;N # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA +03AC;N # GREEK SMALL LETTER ALPHA WITH TONOS +03AD;N # GREEK SMALL LETTER EPSILON WITH TONOS +03AE;N # GREEK SMALL LETTER ETA WITH TONOS +03AF;N # GREEK SMALL LETTER IOTA WITH TONOS +03B0;N # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS +03B1;A # GREEK SMALL LETTER ALPHA +03B2;A # GREEK SMALL LETTER BETA +03B3;A # GREEK SMALL LETTER GAMMA +03B4;A # GREEK SMALL LETTER DELTA +03B5;A # GREEK SMALL LETTER EPSILON +03B6;A # GREEK SMALL LETTER ZETA +03B7;A # GREEK SMALL LETTER ETA +03B8;A # GREEK SMALL LETTER THETA +03B9;A # GREEK SMALL LETTER IOTA +03BA;A # GREEK SMALL LETTER KAPPA +03BB;A # GREEK SMALL LETTER LAMDA +03BC;A # GREEK SMALL LETTER MU +03BD;A # GREEK SMALL LETTER NU +03BE;A # GREEK SMALL LETTER XI +03BF;A # GREEK SMALL LETTER OMICRON +03C0;A # GREEK SMALL LETTER PI +03C1;A # GREEK SMALL LETTER RHO +03C2;N # GREEK SMALL LETTER FINAL SIGMA +03C3;A # GREEK SMALL LETTER SIGMA +03C4;A # GREEK SMALL LETTER TAU +03C5;A # GREEK SMALL LETTER UPSILON +03C6;A # GREEK SMALL LETTER PHI +03C7;A # GREEK SMALL LETTER CHI +03C8;A # GREEK SMALL LETTER PSI +03C9;A # GREEK SMALL LETTER OMEGA +03CA;N # GREEK SMALL LETTER IOTA WITH DIALYTIKA +03CB;N # GREEK SMALL LETTER UPSILON WITH DIALYTIKA +03CC;N # GREEK SMALL LETTER OMICRON WITH TONOS +03CD;N # GREEK SMALL LETTER UPSILON WITH TONOS +03CE;N # GREEK SMALL LETTER OMEGA WITH TONOS +03D0;N # GREEK BETA SYMBOL +03D1;N # GREEK THETA SYMBOL +03D2;N # GREEK UPSILON WITH HOOK SYMBOL +03D3;N # GREEK UPSILON WITH ACUTE AND HOOK SYMBOL +03D4;N # GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL +03D5;N # GREEK PHI SYMBOL +03D6;N # GREEK PI SYMBOL +03D7;N # GREEK KAI SYMBOL +03D8;N # GREEK LETTER ARCHAIC KOPPA +03D9;N # GREEK SMALL LETTER ARCHAIC KOPPA +03DA;N # GREEK LETTER STIGMA +03DB;N # GREEK SMALL LETTER STIGMA +03DC;N # GREEK LETTER DIGAMMA +03DD;N # GREEK SMALL LETTER DIGAMMA +03DE;N # GREEK LETTER KOPPA +03DF;N # GREEK SMALL LETTER KOPPA +03E0;N # GREEK LETTER SAMPI +03E1;N # GREEK SMALL LETTER SAMPI +03E2;N # COPTIC CAPITAL LETTER SHEI +03E3;N # COPTIC SMALL LETTER SHEI +03E4;N # COPTIC CAPITAL LETTER FEI +03E5;N # COPTIC SMALL LETTER FEI +03E6;N # COPTIC CAPITAL LETTER KHEI +03E7;N # COPTIC SMALL LETTER KHEI +03E8;N # COPTIC CAPITAL LETTER HORI +03E9;N # COPTIC SMALL LETTER HORI +03EA;N # COPTIC CAPITAL LETTER GANGIA +03EB;N # COPTIC SMALL LETTER GANGIA +03EC;N # COPTIC CAPITAL LETTER SHIMA +03ED;N # COPTIC SMALL LETTER SHIMA +03EE;N # COPTIC CAPITAL LETTER DEI +03EF;N # COPTIC SMALL LETTER DEI +03F0;N # GREEK KAPPA SYMBOL +03F1;N # GREEK RHO SYMBOL +03F2;N # GREEK LUNATE SIGMA SYMBOL +03F3;N # GREEK LETTER YOT +03F4;N # GREEK CAPITAL THETA SYMBOL +03F5;N # GREEK LUNATE EPSILON SYMBOL +03F6;N # GREEK REVERSED LUNATE EPSILON SYMBOL +03F7;N # GREEK CAPITAL LETTER SHO +03F8;N # GREEK SMALL LETTER SHO +03F9;N # GREEK CAPITAL LUNATE SIGMA SYMBOL +03FA;N # GREEK CAPITAL LETTER SAN +03FB;N # GREEK SMALL LETTER SAN +03FC;N # GREEK RHO WITH STROKE SYMBOL +03FD;N # GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL +03FE;N # GREEK CAPITAL DOTTED LUNATE SIGMA SYMBOL +03FF;N # GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL +0400;N # CYRILLIC CAPITAL LETTER IE WITH GRAVE +0401;A # CYRILLIC CAPITAL LETTER IO +0402;N # CYRILLIC CAPITAL LETTER DJE +0403;N # CYRILLIC CAPITAL LETTER GJE +0404;N # CYRILLIC CAPITAL LETTER UKRAINIAN IE +0405;N # CYRILLIC CAPITAL LETTER DZE +0406;N # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +0407;N # CYRILLIC CAPITAL LETTER YI +0408;N # CYRILLIC CAPITAL LETTER JE +0409;N # CYRILLIC CAPITAL LETTER LJE +040A;N # CYRILLIC CAPITAL LETTER NJE +040B;N # CYRILLIC CAPITAL LETTER TSHE +040C;N # CYRILLIC CAPITAL LETTER KJE +040D;N # CYRILLIC CAPITAL LETTER I WITH GRAVE +040E;N # CYRILLIC CAPITAL LETTER SHORT U +040F;N # CYRILLIC CAPITAL LETTER DZHE +0410;A # CYRILLIC CAPITAL LETTER A +0411;A # CYRILLIC CAPITAL LETTER BE +0412;A # CYRILLIC CAPITAL LETTER VE +0413;A # CYRILLIC CAPITAL LETTER ... [truncated message content] |
From: <th...@us...> - 2008-10-21 10:53:35
|
Revision: 5497 http://jython.svn.sourceforge.net/jython/?rev=5497&view=rev Author: thobes Date: 2008-10-21 10:53:16 +0000 (Tue, 21 Oct 2008) Log Message: ----------- Merged revisions 5287-5295,5297,5301-5305,5307-5308,5313-5317,5320-5321,5323-5325,5327-5329,5333,5339-5444,5446-5447,5452-5460,5462-5480,5482-5495 via svnmerge from https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython ........ r5287 | fwierzbicki | 2008-09-03 17:24:20 +0200 (Wed, 03 Sep 2008) | 3 lines Small cleanup of compiler package. Mainly remove unused imports and rename local vars that shadow member vars. ........ r5288 | fwierzbicki | 2008-09-04 18:57:30 +0200 (Thu, 04 Sep 2008) | 3 lines Fix for some offset problems -- the biggest one being dedents now take on the offset values of the previous token. ........ r5289 | fwierzbicki | 2008-09-05 05:36:04 +0200 (Fri, 05 Sep 2008) | 3 lines Adjustment to offset fix. Overthought the offsets for simple dedents. ........ r5290 | zyasoft | 2008-09-05 18:21:55 +0200 (Fri, 05 Sep 2008) | 4 lines PySystemState.warnoptions was not initialized before adding to it in the processing of the -W option. ........ r5291 | fwierzbicki | 2008-09-05 18:30:36 +0200 (Fri, 05 Sep 2008) | 2 lines Broke test_traceback.py in my last commit. This fixes it again. ........ r5292 | fwierzbicki | 2008-09-06 06:28:11 +0200 (Sat, 06 Sep 2008) | 2 lines Some tuning of node col and line positions to align better with CPython. ........ r5293 | fwierzbicki | 2008-09-06 20:31:14 +0200 (Sat, 06 Sep 2008) | 2 lines Switch back installer25 -> installer. Leaked in from asm branch. ........ r5294 | fwierzbicki | 2008-09-06 20:58:02 +0200 (Sat, 06 Sep 2008) | 2 lines increment version. ........ r5295 | fwierzbicki | 2008-09-06 21:34:07 +0200 (Sat, 06 Sep 2008) | 2 lines Update README. ........ r5297 | fwierzbicki | 2008-09-06 22:57:46 +0200 (Sat, 06 Sep 2008) | 2 lines Remove more leakage from asm branch into build.xml. ........ r5301 | fwierzbicki | 2008-09-07 07:57:26 +0200 (Sun, 07 Sep 2008) | 2 lines Committing Nicholas Riley's patch after getting test_ast.py to work. See http://bugs.jython.org/issue1758279. ........ r5302 | otmarhumbel | 2008-09-08 16:41:41 +0200 (Mon, 08 Sep 2008) | 9 lines Fix for issue #1123: Weird "unexpected at this time" error. The tests if environment variables JAVA_HOME or JYTHON_HOME are set did not work: - if the path contained a space - if the variable really was not set The passed (manual, so far) tests can be found in: http://bugs.jython.org/msg3489 ........ r5303 | leosoto | 2008-09-08 19:48:28 +0200 (Mon, 08 Sep 2008) | 1 line SystemRandom implementation taken from CPython. It depends on urandom(), which seems supported now through jna-posix ........ r5304 | fwierzbicki | 2008-09-09 20:42:57 +0200 (Tue, 09 Sep 2008) | 2 lines Fix some offset problems in DEDENT, INDENT, and EOF. ........ r5305 | fwierzbicki | 2008-09-09 21:06:17 +0200 (Tue, 09 Sep 2008) | 3 lines from: http://svn.python.org/projects/python/branches/release25-maint/Lib@66318 ........ r5307 | fwierzbicki | 2008-09-09 23:15:54 +0200 (Tue, 09 Sep 2008) | 2 lines Disable refcount test with is_jython check. ........ r5308 | otmarhumbel | 2008-09-10 00:34:55 +0200 (Wed, 10 Sep 2008) | 1 line applied leosoto's patch from http://bugs.jython.org/issue1077 to avoid duplicate entries in jython-complete.jar ........ r5313 | fwierzbicki | 2008-09-10 20:36:16 +0200 (Wed, 10 Sep 2008) | 3 lines Make it possible to get error nodes into the spots that are now casting to exprType. ........ r5314 | otmarhumbel | 2008-09-11 00:45:07 +0200 (Thu, 11 Sep 2008) | 3 lines since property cpythonlib.present is always true if jython is checked out correctly, but is evaluated too early (long before checkout) during a full-build, it has probably no usage any more ........ r5315 | otmarhumbel | 2008-09-11 01:06:04 +0200 (Thu, 11 Sep 2008) | 4 lines reintroduced the possibility to suppress checkout in full-build (setting do.checkout to 'false' does not prevent from checking out, but not setting the property at all really does) so full-build behaviour should remain the same ........ r5316 | fwierzbicki | 2008-09-11 02:37:30 +0200 (Thu, 11 Sep 2008) | 2 lines update readme for Jython 2.5a3. ........ r5317 | fwierzbicki | 2008-09-11 02:39:43 +0200 (Thu, 11 Sep 2008) | 2 lines Change defaults for alpha 3. ........ r5320 | fwierzbicki | 2008-09-11 21:48:35 +0200 (Thu, 11 Sep 2008) | 3 lines Transform if/elif/else into the correct If nodes in the grammar file instead of as a code post-processing step. ........ r5321 | fwierzbicki | 2008-09-11 22:18:43 +0200 (Thu, 11 Sep 2008) | 2 lines Allow the possibility of using error nodes for bad stmtType. ........ r5323 | leosoto | 2008-09-13 19:04:58 +0200 (Sat, 13 Sep 2008) | 1 line Test for the 'feature' described on #1089: cStringIO.StringIO.read always returns string objects ........ r5324 | amak | 2008-09-13 20:09:58 +0200 (Sat, 13 Sep 2008) | 11 lines Checking in fixes for 3 bugs http://bugs.jython.org/issue1119 - socket module has no attribute SO_ERROR http://bugs.jython.org/issue1120 - invalid socket shutdown gives AssertionError, should be "transport endpoint not connected" socket.error http://bugs.jython.org/issue1121 - listening socket shutdown expects the wrong kind of socket ........ r5325 | amak | 2008-09-13 20:31:07 +0200 (Sat, 13 Sep 2008) | 5 lines Change of mind on behaviour when shutting down server sockets. Instead to raising an exception, best to let the failure pass silently, as cpython does. http://bugs.jython.org/issue1121 ........ r5327 | zyasoft | 2008-09-13 21:02:55 +0200 (Sat, 13 Sep 2008) | 2 lines Tests that __module__ is available during class definition time, for #1022 ........ r5328 | zyasoft | 2008-09-14 02:08:28 +0200 (Sun, 14 Sep 2008) | 4 lines Adds tests: test_copy, test_profilehooks, test_random, test_syntax, test_trace that should be reasonable for Jython (possibly with modifications) Provides coverage for #1738411 ........ r5329 | pjenvey | 2008-09-14 02:27:02 +0200 (Sun, 14 Sep 2008) | 1 line small cleanup ........ r5333 | fwierzbicki | 2008-09-16 01:57:05 +0200 (Tue, 16 Sep 2008) | 2 lines make accept and traverse no-ops for error nodes. ........ r5339 | fwierzbicki | 2008-09-18 21:07:35 +0200 (Thu, 18 Sep 2008) | 3 lines Fixed another eof/whitespace parsing issue from Django. Turned all of these problems into a new test: test_eof_jy.py. ........ r5340 | fwierzbicki | 2008-09-18 21:37:19 +0200 (Thu, 18 Sep 2008) | 3 lines Unicode ast node is a kludge from long ago whose time has passed. I forgot to remove it when I unified str node handling in the parser. ........ r5341 | leosoto | 2008-09-20 04:08:34 +0200 (Sat, 20 Sep 2008) | 1 line PyType now exposes __repr__ and __str__ as documented on <http://wiki.python.org/jython/JythonDeveloperGuide/ImplementingStrAndRepr>. This fixes #1131 ........ r5342 | leosoto | 2008-09-21 02:20:23 +0200 (Sun, 21 Sep 2008) | 1 line importing test_support from the test package on test_exceptions.py ........ r5343 | pjenvey | 2008-09-24 21:44:25 +0200 (Wed, 24 Sep 2008) | 4 lines it's more correct for StdoutWrapper to write the object being printed to the file instead of __str__'ing it refs #1130 ........ r5344 | pjenvey | 2008-09-24 21:56:28 +0200 (Wed, 24 Sep 2008) | 1 line revert r5343, it's broken ........ r5345 | fwierzbicki | 2008-09-24 23:05:39 +0200 (Wed, 24 Sep 2008) | 4 lines Switched PythonPartial.g from being a "grammar" to being a "parser grammar", plus some additional related cleanup. This fixes all of the missing Token warnings. Thanks to Terrance Parr for suggesting this fix. ........ r5346 | thobes | 2008-09-25 00:12:23 +0200 (Thu, 25 Sep 2008) | 4 lines Fixed the bug of the __exit__ method not being invoked on the outer context manager in the case of nested with statements. The problem was that the exception handlers were not properly sorted. ........ r5347 | thobes | 2008-09-25 20:52:30 +0200 (Thu, 25 Sep 2008) | 7 lines Fix of the bug with "def f(): lambda x=(yield): 1". The problem was that the order of instructions were such that there was elements on the stack before the yield-point that does not get restored. I also found another problem in that the types for local variables in CodeCompiler are not proper java types, this is in error in nearly all places, and needs to be fixed in a later commit. ........ r5348 | pjenvey | 2008-09-25 23:12:28 +0200 (Thu, 25 Sep 2008) | 5 lines bump tarfile from 2.5.1 to 2.5.2, from: http://svn.python.org/projects/python/branches/release25-maint/Lib tarfile.py@60730 test/test_tarfile.py@60730 ........ r5349 | pjenvey | 2008-09-25 23:16:30 +0200 (Thu, 25 Sep 2008) | 6 lines reapply previous tarfile modifications: o don't assume a reference counting GC o ensure all file handles are closed to avoid os.remove problems on windows o always use the tempdir, even when testtar is a relative path (it is when ran via the regrtest) ........ r5350 | fwierzbicki | 2008-09-26 16:41:55 +0200 (Fri, 26 Sep 2008) | 3 lines Correct this for new __class__.__name__ package truncating behavior of Java classes. ........ r5351 | thobes | 2008-09-26 17:37:19 +0200 (Fri, 26 Sep 2008) | 4 lines Fix to allow the yield statement to apear in the first iterator of a generator expression. This exposes another problem where the stack state is not persisted from yielding to resuming. ........ r5352 | fwierzbicki | 2008-09-26 19:01:58 +0200 (Fri, 26 Sep 2008) | 3 lines Fixes an infinite loop that occurs when there is an unterminated triple string and ListErrorHandler is being used. ........ r5353 | fwierzbicki | 2008-10-01 04:01:33 +0200 (Wed, 01 Okt 2008) | 3 lines Added castSlice and castSlices to allow optional error nodes for sliceType. Also renamed makeExpr(s) and makeStmt(s) to castExpr(s) and castStmt(s). ........ r5354 | pjenvey | 2008-10-02 02:13:21 +0200 (Thu, 02 Okt 2008) | 2 lines remove more remnants of org.python.antlr.ast.Unicode ........ r5355 | pjenvey | 2008-10-02 02:16:29 +0200 (Thu, 02 Okt 2008) | 1 line whitespace ........ r5356 | pjenvey | 2008-10-02 04:31:03 +0200 (Thu, 02 Okt 2008) | 3 lines from: http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_asynchat.py@46906 ........ r5357 | pjenvey | 2008-10-05 02:00:24 +0200 (Sun, 05 Okt 2008) | 3 lines avoid test_asynchat on BSD where it deadlocks refs #1064 ........ r5358 | pjenvey | 2008-10-05 02:01:52 +0200 (Sun, 05 Okt 2008) | 1 line fix mislabeled names ........ r5359 | zyasoft | 2008-10-06 05:02:29 +0200 (Mon, 06 Okt 2008) | 3 lines From http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_random.py@53510 ........ r5360 | zyasoft | 2008-10-06 05:12:34 +0200 (Mon, 06 Okt 2008) | 6 lines Removed older version of random.py in favor of CPythonLib's; added _random.getrandbits (in PyRandom); modified test_random so that it doesn't test implementation specific aspects of the random generator, since we actually use java.util.Random, not the Mersenne Twister. ........ r5361 | zyasoft | 2008-10-06 20:57:58 +0200 (Mon, 06 Okt 2008) | 6 lines Fixed test_quopri by encoding space or tab before newline and resetting the column count upon a newline Fixed #1144 so that -mMODULE works and remaining args are passed in sys.argv ........ r5362 | zyasoft | 2008-10-06 22:42:04 +0200 (Mon, 06 Okt 2008) | 3 lines From http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_trace.py@60582 ........ r5363 | zyasoft | 2008-10-06 23:48:03 +0200 (Mon, 06 Okt 2008) | 6 lines Removed test cases not applicable to Jython. Although it's not possible to implement jump when compiled to Java bytecode, it's possible that we can better align our trace with what is done in CPython, so this should be revisited at some point. ........ r5364 | zyasoft | 2008-10-07 00:00:46 +0200 (Tue, 07 Okt 2008) | 3 lines From http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_profilehooks.py@35570 ........ r5365 | zyasoft | 2008-10-07 00:08:13 +0200 (Tue, 07 Okt 2008) | 5 lines Similar mass removal of tests as in test_trace, these all are related to some fundamental differences in our VM, especially around exception handling. ........ r5366 | pjenvey | 2008-10-10 01:23:05 +0200 (Fri, 10 Okt 2008) | 3 lines fix lambdas within decorator args causing an NPE. we weren't initializing their scopes ........ r5367 | fwierzbicki | 2008-10-10 20:12:58 +0200 (Fri, 10 Okt 2008) | 2 lines Cleaning up dead code. ........ r5368 | zyasoft | 2008-10-11 04:24:42 +0200 (Sat, 11 Okt 2008) | 3 lines From http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_copy.py@42573 ........ r5369 | zyasoft | 2008-10-11 04:38:55 +0200 (Sat, 11 Okt 2008) | 9 lines Make "extended" builtin functions in __builtin__ (that is, functions like max which use a class like MaxFunction for their definition) copyable by copy.copy and return the correct type. This fixes test_copy, along with enabling reflexive structures to be compared, since we don't prohibit or otherwise detect them in the copying anyway. ........ r5370 | zyasoft | 2008-10-11 05:37:39 +0200 (Sat, 11 Okt 2008) | 2 lines Patch from #1075, thanks Matt Boersma! ........ r5371 | pjenvey | 2008-10-11 07:08:23 +0200 (Sat, 11 Okt 2008) | 3 lines disable test_compiler as we don't intend to support the parser module compiler relies on, with _ast being the way forward ........ r5372 | pjenvey | 2008-10-11 08:42:35 +0200 (Sat, 11 Okt 2008) | 3 lines fix solid_base potentially resolving the wrong type when called before the mro was initialized. caused best_base to blowup with a TypeError ........ r5373 | fwierzbicki | 2008-10-11 22:54:47 +0200 (Sat, 11 Okt 2008) | 3 lines Throw a Python exception for two internal compiler errors that where just printing a less useful error message and going on to an NPE. ........ r5374 | fwierzbicki | 2008-10-11 23:29:29 +0200 (Sat, 11 Okt 2008) | 11 lines A very basic start to supporting pep 328 style relative imports like from . import foo This patch just passes the "level" (that is number of dots) information from the compile to the import machinary without actually using it, and forbids from . import * As Python 2.5 does. ........ r5375 | pjenvey | 2008-10-12 01:16:54 +0200 (Sun, 12 Okt 2008) | 2 lines fix unicodedata.lookup to return unicode instead of the codepoint int ........ r5376 | zyasoft | 2008-10-12 02:18:38 +0200 (Sun, 12 Okt 2008) | 3 lines From http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_struct.py@60892 ........ r5377 | zyasoft | 2008-10-12 02:24:30 +0200 (Sun, 12 Okt 2008) | 2 lines Implemented struct.Struct as well as other updates in the struct module for 2.5 ........ r5378 | zyasoft | 2008-10-12 02:25:07 +0200 (Sun, 12 Okt 2008) | 2 lines Missing module for previous commit! ........ r5379 | fwierzbicki | 2008-10-12 18:28:15 +0200 (Sun, 12 Okt 2008) | 7 lines More groundwork for absolute_import. Passing level info into most of the places it needs to go, also now sending the correct level information when "from __future__ import absolute_import" is issued. Added a constant in imp.java DEFAULT_LEVEL, so that it can be changed in one place when absolute import becomes the default behavior. ........ r5380 | pjenvey | 2008-10-12 22:10:04 +0200 (Sun, 12 Okt 2008) | 5 lines fix bad bytecode generated for: a[[b for b, c in d]] = e the store was losing track of the value (e) here because the list comp/tuple unpack combo overwrote where e's location was held ........ r5381 | pjenvey | 2008-10-13 00:18:06 +0200 (Mon, 13 Okt 2008) | 2 lines better unhashable TypeError messages ........ r5382 | pjenvey | 2008-10-13 00:37:53 +0200 (Mon, 13 Okt 2008) | 2 lines update the deriveds for better unhashable TypeError messages ........ r5383 | pjenvey | 2008-10-13 01:00:34 +0200 (Mon, 13 Okt 2008) | 1 line fix the renamed _collections ........ r5384 | fwierzbicki | 2008-10-13 19:19:47 +0200 (Mon, 13 Okt 2008) | 2 lines Fixed issue http://bugs.jython.org/issue1111: keyword arguments not supported on __import__ ........ r5385 | fwierzbicki | 2008-10-13 19:31:05 +0200 (Mon, 13 Okt 2008) | 4 lines disable test_transformer for the same reason we disabled test_compiler: we don't intend to support the parser module compiler relies on, with _ast being the way forward. transformer.py is in the same area of code. ........ r5386 | fwierzbicki | 2008-10-13 20:50:06 +0200 (Mon, 13 Okt 2008) | 7 lines Fixed "expected skips" that wheren't actually being skipped. Also added test_peepholer and test_profile to expected failures since these are platform specific tests. This is a work around, we should (most likely) go back and force these expected failures to skip in Jython, but I want to do that in one future sweep. ........ r5387 | fwierzbicki | 2008-10-13 21:41:45 +0200 (Mon, 13 Okt 2008) | 3 lines from http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_with.py@66619 ........ r5388 | fwierzbicki | 2008-10-13 22:38:36 +0200 (Mon, 13 Okt 2008) | 4 lines Disabling tests of "as" and "with" semi-keyword status, for now it's too hard to get antlr to treat them as almost-keywords. I want to revisit, but this is a low priority compared to other problems. ........ r5389 | cgroves | 2008-10-14 03:47:30 +0200 (Tue, 14 Okt 2008) | 1 line Jarjar if antlr changed more recently than the jarjar'd jar. Jar. ........ r5390 | leosoto | 2008-10-14 05:20:10 +0200 (Tue, 14 Okt 2008) | 1 line Now String is mapped to PyUnicode on ClassicPyObjectAdapter (instead of mapping it to PyString). Thus, for APIs which really need to return bytestrings (such as PyFile) we now have to explicitely declare the return type as PyString (and on code written in Python, use StringUtil.asPyString(String)). Fixes #1128 ........ r5391 | fwierzbicki | 2008-10-14 18:43:46 +0200 (Tue, 14 Okt 2008) | 4 lines Fix or skips for most remaining problems in test_syntax.py. All remaining problems are due to the lack of enforcement on continuations not being permitted in finally. ........ r5392 | fwierzbicki | 2008-10-14 21:28:28 +0200 (Tue, 14 Okt 2008) | 4 lines Added inFinally parameter to suite rule, and a dynamically scoped parameter continueIllegal to support disallowing continue in a finally clause. This fixes test_syntax. ........ r5393 | pjenvey | 2008-10-15 01:08:45 +0200 (Wed, 15 Okt 2008) | 5 lines o fix the socket hostname functions returning unicode hostnames instead of strs. was causing test_wsgiref to fail on environments where socket.getfqdn('localhost') != 'localhost' o fix getaddrinfo default family and handling of bad familys ........ r5394 | pjenvey | 2008-10-15 02:46:02 +0200 (Wed, 15 Okt 2008) | 2 lines fix solid_base considering slotted objects with a __dict__ as solid ........ r5395 | cgroves | 2008-10-15 06:42:15 +0200 (Wed, 15 Okt 2008) | 8 lines Remove build/exposed from the classpath. Having it in there meant any source navigation like F3 or Open Type would go to the exposed version rather than the source version that you were really after. Not having it in there means you need to add the exposed dir to the classpath of any run configurations in Eclipse, but that felt like a lesser evil than my smiting my keyboard in frustration every time Eclipse opened the wrong file. ........ r5396 | otmarhumbel | 2008-10-15 07:35:53 +0200 (Wed, 15 Okt 2008) | 1 line fixed typo: _JAVA_HOME has to be JAVA_HOME ........ r5397 | otmarhumbel | 2008-10-15 10:10:37 +0200 (Wed, 15 Okt 2008) | 7 lines safely test if JAVA_HOME or JYTHON_HOME is set we can now handle both quoted and unquoted settings like: JAVA_HOME=C:\Program Files\Java\jdk1.6.0_07 JAVA_HOME="C:\Program Files\Java\jdk1.6.0_07" this should fix issue #1125 ........ r5398 | otmarhumbel | 2008-10-15 17:56:58 +0200 (Wed, 15 Okt 2008) | 1 line applied lsoto's PyString change (revision 5390) to this handler as well ........ r5399 | fwierzbicki | 2008-10-15 19:06:58 +0200 (Wed, 15 Okt 2008) | 6 lines New dotted and absolute import support. I have local tests, but have not figured out how to integrate them into the regression tests. Examining the tests in CPython does not appear to give much guidance here, the testing of these features looks pretty thin (mainly they test features around __package__ which is new in 2.6). Maybe I just haven't found the relevant tests? ........ r5400 | fwierzbicki | 2008-10-15 22:10:46 +0200 (Wed, 15 Okt 2008) | 2 lines ? was replaced by <module> in info. ........ r5401 | fwierzbicki | 2008-10-15 22:16:53 +0200 (Wed, 15 Okt 2008) | 5 lines Guard the Java-specific top imports with an is_jython. This way some of the bugtests can run in pure python to make it easier to tilt at this windmill: http://code.google.com/p/google-highly-open-participation-psf/source/browse/trunk/submissions/jython-tests-26-50.txt?r=424 Windmill summary: Turn all bugtests into real unit tests or kill. ........ r5402 | fwierzbicki | 2008-10-15 22:22:02 +0200 (Wed, 15 Okt 2008) | 2 lines Move bugtests/test076.py into regrtest. ........ r5403 | fwierzbicki | 2008-10-15 22:23:35 +0200 (Wed, 15 Okt 2008) | 2 lines test077.py is well tested in our current unit tests. ........ r5404 | fwierzbicki | 2008-10-15 22:35:18 +0200 (Wed, 15 Okt 2008) | 2 lines test078.py is outdated. ........ r5405 | fwierzbicki | 2008-10-15 22:37:54 +0200 (Wed, 15 Okt 2008) | 2 lines "find" is well tested and doesn't need this extra test. ........ r5406 | fwierzbicki | 2008-10-15 22:41:18 +0200 (Wed, 15 Okt 2008) | 3 lines test_pkgimport.py already does a reasonable job of checking multiple imports of the same .py file. ........ r5407 | fwierzbicki | 2008-10-15 22:42:47 +0200 (Wed, 15 Okt 2008) | 2 lines cleanup dead code. ........ r5408 | fwierzbicki | 2008-10-15 22:44:08 +0200 (Wed, 15 Okt 2008) | 2 lines This basic re functionality is well tested in our existing unit tests. ........ r5409 | fwierzbicki | 2008-10-15 22:52:30 +0200 (Wed, 15 Okt 2008) | 4 lines test089.py looks like it is very confused :) Maybe string.replace changed oh so long ago? /me shrugs and deletes. ........ r5410 | fwierzbicki | 2008-10-15 22:55:46 +0200 (Wed, 15 Okt 2008) | 6 lines Comment at the top Does not work, will never work. Wow. Deleted. ........ r5411 | fwierzbicki | 2008-10-16 03:48:49 +0200 (Thu, 16 Okt 2008) | 2 lines another "will never work" test. Deleted. ........ r5412 | fwierzbicki | 2008-10-16 03:53:07 +0200 (Thu, 16 Okt 2008) | 3 lines Just tests the existance of a __name__ and __doc__ for the exceptions module. Not enough of a test to preserve. ........ r5413 | fwierzbicki | 2008-10-16 03:53:49 +0200 (Thu, 16 Okt 2008) | 2 lines deleting completely empty test. ........ r5414 | fwierzbicki | 2008-10-16 04:21:51 +0200 (Thu, 16 Okt 2008) | 2 lines Moved unique id test to test_jy_internals ........ r5415 | fwierzbicki | 2008-10-16 04:56:10 +0200 (Thu, 16 Okt 2008) | 2 lines First get test102.py working again... ........ r5416 | fwierzbicki | 2008-10-16 05:11:28 +0200 (Thu, 16 Okt 2008) | 2 lines test102 moved to test_jy_internals.py ........ r5417 | fwierzbicki | 2008-10-16 05:14:39 +0200 (Thu, 16 Okt 2008) | 2 lines Another empty test. ........ r5418 | fwierzbicki | 2008-10-16 05:15:27 +0200 (Thu, 16 Okt 2008) | 2 lines Another "does not work" ........ r5419 | pjenvey | 2008-10-16 05:28:52 +0200 (Thu, 16 Okt 2008) | 2 lines another unicode/str regression: co_name and co_filename should be a str ........ r5420 | pjenvey | 2008-10-16 08:38:43 +0200 (Thu, 16 Okt 2008) | 3 lines fix os.access not handling multiple modes, and make its X_OK work via jna-posix's stat ........ r5421 | fwierzbicki | 2008-10-16 14:07:24 +0200 (Thu, 16 Okt 2008) | 3 lines Move essential part of test106 to test_jy_compile.py (bare return not permitted in exec). ........ r5422 | fwierzbicki | 2008-10-16 14:15:26 +0200 (Thu, 16 Okt 2008) | 2 lines First make test107 pass in both python and jython ........ r5423 | fwierzbicki | 2008-10-16 14:42:06 +0200 (Thu, 16 Okt 2008) | 2 lines move test107 to test_jy_internals.py ........ r5424 | fwierzbicki | 2008-10-16 16:26:23 +0200 (Thu, 16 Okt 2008) | 2 lines Moved test108 to test_dict_jy ........ r5425 | fwierzbicki | 2008-10-16 16:27:55 +0200 (Thu, 16 Okt 2008) | 2 lines This basic functionality is well tested. ........ r5426 | fwierzbicki | 2008-10-16 16:29:48 +0200 (Thu, 16 Okt 2008) | 2 lines Basic dict functionality that is well tested in the unit tests. ........ r5427 | fwierzbicki | 2008-10-16 16:31:14 +0200 (Thu, 16 Okt 2008) | 3 lines Pretty much just a test for lists being disallowed as a key which is already in the unit tests. ........ r5428 | fwierzbicki | 2008-10-16 16:33:33 +0200 (Thu, 16 Okt 2008) | 2 lines Basic slice ops that are already well tested. ........ r5429 | fwierzbicki | 2008-10-16 16:34:25 +0200 (Thu, 16 Okt 2008) | 2 lines This test doesn't make much sense. ........ r5430 | fwierzbicki | 2008-10-16 16:36:02 +0200 (Thu, 16 Okt 2008) | 2 lines basic test of int subclasses which is well covered by current tests. ........ r5431 | fwierzbicki | 2008-10-16 18:13:52 +0200 (Thu, 16 Okt 2008) | 2 lines Leftover for long-gone test049. ........ r5432 | fwierzbicki | 2008-10-16 18:18:04 +0200 (Thu, 16 Okt 2008) | 2 lines move test124 to test_jy_internals. ........ r5433 | pjenvey | 2008-10-16 18:54:06 +0200 (Thu, 16 Okt 2008) | 1 line typo ........ r5434 | fwierzbicki | 2008-10-16 19:48:03 +0200 (Thu, 16 Okt 2008) | 3 lines The reload builtin is tested in a number of places in the unit tests, so this basic test of it can be deleted. ........ r5435 | fwierzbicki | 2008-10-16 19:48:56 +0200 (Thu, 16 Okt 2008) | 2 lines Very basic test of assert that is no longer needed as assert is well tested. ........ r5436 | fwierzbicki | 2008-10-16 19:50:37 +0200 (Thu, 16 Okt 2008) | 2 lines This test is already covered by a test in test_jy_internals. ........ r5437 | fwierzbicki | 2008-10-16 19:51:59 +0200 (Thu, 16 Okt 2008) | 2 lines Covered in test_jy_internals already. ........ r5438 | fwierzbicki | 2008-10-16 20:56:04 +0200 (Thu, 16 Okt 2008) | 2 lines moved test130 to test_cmp_jy. ........ r5439 | fwierzbicki | 2008-10-16 20:58:39 +0200 (Thu, 16 Okt 2008) | 2 lines This is well tested in test_hexoct.py ........ r5440 | fwierzbicki | 2008-10-16 22:19:50 +0200 (Thu, 16 Okt 2008) | 2 lines moved test131 into test_java_integration ........ r5441 | fwierzbicki | 2008-10-16 22:22:15 +0200 (Thu, 16 Okt 2008) | 2 lines test_glob thoroughly tests glob. ........ r5442 | fwierzbicki | 2008-10-16 22:24:04 +0200 (Thu, 16 Okt 2008) | 3 lines This really just tests that copy.copy exists. We run the real test_copy and so have no need for this test. ........ r5443 | fwierzbicki | 2008-10-16 22:32:40 +0200 (Thu, 16 Okt 2008) | 2 lines moved test136 to test_java_integration.py ........ r5444 | fwierzbicki | 2008-10-16 22:34:32 +0200 (Thu, 16 Okt 2008) | 2 lines better name for test method. ........ r5446 | cgroves | 2008-10-16 22:59:53 +0200 (Thu, 16 Okt 2008) | 9 lines Use assertRaises instead of try: code except ExpectedException: pass else: self.fail ........ r5447 | fwierzbicki | 2008-10-16 23:15:59 +0200 (Thu, 16 Okt 2008) | 3 lines put in null guard for cflags call. cflags can definitely be null at this point in the code. ........ r5452 | pjenvey | 2008-10-17 02:04:42 +0200 (Fri, 17 Okt 2008) | 2 lines minor xrange optimization: use the small int cache ........ r5453 | cgroves | 2008-10-17 09:06:39 +0200 (Fri, 17 Okt 2008) | 1 line A couple slices from Occam's razor, and speedups for items and keys by making arrays for PyList directly instead of making Lists and letting PyList turn them into arrays ........ r5454 | thobes | 2008-10-17 20:15:50 +0200 (Fri, 17 Okt 2008) | 3 lines Modifying the generated bytecode so that yield as an expression does not empty the stack. ........ r5455 | thobes | 2008-10-17 21:28:20 +0200 (Fri, 17 Okt 2008) | 2 lines Removed some erronious code in visitYield. ........ r5456 | thobes | 2008-10-17 22:46:47 +0200 (Fri, 17 Okt 2008) | 4 lines Improved the scope analysis for generator expressions. Also fixed a bug in my recent commit where the fix for yield as an expression accidentially reordered the value to be yielded on the stack. ........ r5457 | thobes | 2008-10-17 23:21:36 +0200 (Fri, 17 Okt 2008) | 4 lines Added a check for return and yield in the same scope in ScopesCompiler, There are cases that can be missed in CodeCompiler due to dead code elimination, this gets around that. ........ r5458 | pjenvey | 2008-10-18 01:55:52 +0200 (Sat, 18 Okt 2008) | 3 lines allow more heap for the regrtest to avoid the OutOfMemory errors. we don't seem to actually be leaking -- we just have more test modules ........ r5459 | pjenvey | 2008-10-18 01:56:07 +0200 (Sat, 18 Okt 2008) | 2 lines remove stray print statement that was preventing this from passing ........ r5460 | pjenvey | 2008-10-18 03:58:29 +0200 (Sat, 18 Okt 2008) | 4 lines store the symbol name info in a LinkedHashMap to maintain the order they're encountered in. fixes test_code technically this should bump the bytecode magic but it's not that important ........ r5462 | pjenvey | 2008-10-18 22:23:01 +0200 (Sat, 18 Okt 2008) | 3 lines fix os.access to never raise an exception with a valid mode, which I broke in r5420 ........ r5463 | pjenvey | 2008-10-19 02:01:20 +0200 (Sun, 19 Okt 2008) | 7 lines fix forgetting to free the var/starargs of Calls, which produced bad byte for: def gen(): if True: # or b(**c) a = b(*c) yield d ........ r5464 | cgroves | 2008-10-19 05:04:44 +0200 (Sun, 19 Okt 2008) | 1 line Some formatting and cleanup ........ r5465 | cgroves | 2008-10-19 07:14:22 +0200 (Sun, 19 Okt 2008) | 8 lines Rename PyBuiltinFunction to PyBuiltinCallable, and remake PyBuiltinFunction as a base for functions with the basic function stuff from PyBuiltinFunctionSet. Extend that with PyBuiltinFunctionNarrow for functions with a fixed set of args to match PyBuiltinMethodNarrow. Use the new function stuff to implement the builtin functions that were using ExtendedBuiltinFunction as real functions instead of PyObjects. ........ r5466 | cgroves | 2008-10-19 07:17:07 +0200 (Sun, 19 Okt 2008) | 1 line Missed a sppot ........ r5467 | pjenvey | 2008-10-19 08:51:07 +0200 (Sun, 19 Okt 2008) | 3 lines fix visitCompare leaving the left side on the stack, causing a minor short term memory leak ........ r5468 | zyasoft | 2008-10-19 17:16:29 +0200 (Sun, 19 Okt 2008) | 3 lines from http://svn.python.org/projects/python/branches/release25-maint/Lib/test/test_codeccallbacks.py@46456 ........ r5469 | pjenvey | 2008-10-19 22:51:56 +0200 (Sun, 19 Okt 2008) | 3 lines move the last visitCompare fix to after the end label so we also avoid the issue when a chained comparison fails fast ........ r5470 | zyasoft | 2008-10-20 00:04:51 +0200 (Mon, 20 Okt 2008) | 5 lines Make error handling in codecs so that it is also surrogate-aware. Fixes test_codeccallbacks Skip tests from test_threading not applicable to Jython. ........ r5471 | cgroves | 2008-10-20 01:17:44 +0200 (Mon, 20 Okt 2008) | 1 line Add a couple tests for subclass constructor visibility ........ r5472 | zyasoft | 2008-10-20 01:18:22 +0200 (Mon, 20 Okt 2008) | 7 lines PEP 342 specifies that an exception raised by close during finalization should be output to stderr, so we now do that. Fixed a minor doctest output formatting issue so that the desired syntax error is properly seen. ........ r5473 | cgroves | 2008-10-20 01:30:32 +0200 (Mon, 20 Okt 2008) | 1 line Replace StringUtil.asPyString with Py.newString ........ r5474 | pjenvey | 2008-10-20 02:44:52 +0200 (Mon, 20 Okt 2008) | 2 lines bump java's stack size to 768k on solaris, to fix test_cpickle there ........ r5475 | cgroves | 2008-10-20 03:01:39 +0200 (Mon, 20 Okt 2008) | 8 lines Add an ant resource collection that's like union except it combines based on the name of the resource instead of its full path. Use this to exclude the unexposed version of classes from jython.jar to keep it quiet. Resource collections didn't appear until Ant 1.7, but that came out nearly 2 years ago, so I'm hoping most people already have it. ........ r5476 | cgroves | 2008-10-20 03:40:25 +0200 (Mon, 20 Okt 2008) | 1 line Remove newcompiler since it's not being used now and it's going to be replaced by the advanced compiler ........ r5477 | cgroves | 2008-10-20 03:41:32 +0200 (Mon, 20 Okt 2008) | 1 line Move BaseTypeBuilder out of TypeExposer so the compile time bits of the exposing system can be excluded from jython.jar ........ r5478 | cgroves | 2008-10-20 04:03:44 +0200 (Mon, 20 Okt 2008) | 1 line Cleanup, modernization ........ r5479 | cgroves | 2008-10-20 08:29:50 +0200 (Mon, 20 Okt 2008) | 9 lines The pain of not having the generic inferring statics from Google collections finally got to the point where I felt the need to whip up version for Jython. Add Generic with static methods to make Lists, Maps and Sets that infer their generic types from the generics of whatever they're being assigned to. I went for brevity in naming the methods as I felt they'd be idiomatic enough in Jython to read well, but could be convinced that more descriptive names - newArrayList() instead of list() for example - would be better. ........ r5480 | thobes | 2008-10-20 13:13:38 +0200 (Mon, 20 Okt 2008) | 3 lines Fixed the evaluation order bug made visual by test_generators. Added a test file for evaluation order tests. ........ r5482 | thobes | 2008-10-20 19:19:57 +0200 (Mon, 20 Okt 2008) | 5 lines Added support for class decorators. The test file added for this (test_classdecorators) should be removed when we import test_decorators from CPython 3.x, because that is where the caes come from. This is also documented in that file. ........ r5483 | pjenvey | 2008-10-20 22:01:14 +0200 (Mon, 20 Okt 2008) | 2 lines make sock.listen() explicitly require the backlog argument to match CPython ........ r5484 | pjenvey | 2008-10-20 22:05:02 +0200 (Mon, 20 Okt 2008) | 4 lines revert r5474 and bump Java's stack size to 1024k, matching 64 bit Java's default. 32 bit needs an increase to at least 512k to pass test_cpickle, but we don't want to shrink 64 bit's default ........ r5485 | pjenvey | 2008-10-20 23:18:08 +0200 (Mon, 20 Okt 2008) | 5 lines o delete references to test.test_ modules in the test package after running them to conserve memory o bump ant regrtest's heap to 144m which is about the minimum needed for Apple's 64 bit Java 6 (server VM) ........ r5486 | fwierzbicki | 2008-10-20 23:37:06 +0200 (Mon, 20 Okt 2008) | 6 lines PythonPartial.g should allow decorators without classes or functions so that @foo is a valid partial sentence. ........ r5487 | pjenvey | 2008-10-21 01:53:47 +0200 (Tue, 21 Okt 2008) | 2 lines __iter__ is just another file_self call ........ r5488 | pjenvey | 2008-10-21 01:54:14 +0200 (Tue, 21 Okt 2008) | 3 lines allow abuse of _fileobject by fixing its close() to act like CPython's when the underlying _sock isn't a Jython socket. fixes test_urllib2net ........ r5489 | fwierzbicki | 2008-10-21 02:21:45 +0200 (Tue, 21 Okt 2008) | 2 lines moved test138 to test_str_jy. ........ r5490 | fwierzbicki | 2008-10-21 02:24:00 +0200 (Tue, 21 Okt 2008) | 2 lines spelling fix. ........ r5491 | fwierzbicki | 2008-10-21 02:35:49 +0200 (Tue, 21 Okt 2008) | 3 lines Charlie Groves pushed me over the "maybe the test is just dumb?" barrier. ........ r5492 | fwierzbicki | 2008-10-21 02:38:12 +0200 (Tue, 21 Okt 2008) | 3 lines This one looks like it is testing multiple inheritance of Java classes which is long gone. Also it imports a module which shouldn't exist. Deleting. ........ r5493 | fwierzbicki | 2008-10-21 02:40:02 +0200 (Tue, 21 Okt 2008) | 2 lines These three tests are well covered by existing tests. ........ r5494 | fwierzbicki | 2008-10-21 02:40:55 +0200 (Tue, 21 Okt 2008) | 2 lines This is well tested by existing unit tests. ........ r5495 | fwierzbicki | 2008-10-21 02:47:13 +0200 (Tue, 21 Okt 2008) | 2 lines Doesn't really test anything... ........ Revision Links: -------------- http://jython.svn.sourceforge.net/jython/?rev=5390&view=rev Modified Paths: -------------- branches/advanced/.classpath branches/advanced/CoreExposed.includes branches/advanced/Lib/javapath.py branches/advanced/Lib/os.py branches/advanced/Lib/socket.py branches/advanced/Lib/tarfile.py branches/advanced/Lib/test/regrtest.py branches/advanced/Lib/test/test_ast.py branches/advanced/Lib/test/test_class_jy.py branches/advanced/Lib/test/test_cmp_jy.py branches/advanced/Lib/test/test_dict_jy.py branches/advanced/Lib/test/test_exceptions.py branches/advanced/Lib/test/test_exceptions_jy.py branches/advanced/Lib/test/test_generators.py branches/advanced/Lib/test/test_java_integration.py branches/advanced/Lib/test/test_java_visibility.py branches/advanced/Lib/test/test_jy_compile.py branches/advanced/Lib/test/test_jy_internals.py branches/advanced/Lib/test/test_socket.py branches/advanced/Lib/test/test_syntax.py branches/advanced/Lib/test/test_tarfile.py branches/advanced/Lib/test/test_threading.py branches/advanced/Lib/unicodedata.py branches/advanced/Lib/zlib.py branches/advanced/NEWS branches/advanced/README.txt branches/advanced/ast/Python.asdl branches/advanced/ast/astview.py branches/advanced/ast/jastlib.py branches/advanced/bugtests/support.py branches/advanced/bugtests/test081.py branches/advanced/build.xml branches/advanced/compiler/org/python/compiler/DirectGenerator.java branches/advanced/compiler/org/python/compiler/FlowGraphGenerator.java branches/advanced/compiler/org/python/compiler/advanced/ast/AstToBytecode.java branches/advanced/grammar/Python.g branches/advanced/grammar/PythonPartial.g branches/advanced/src/com/ziclix/python/sql/DataHandler.java branches/advanced/src/com/ziclix/python/sql/JDBC20DataHandler.java branches/advanced/src/com/ziclix/python/sql/Jython22DataHandler.java branches/advanced/src/com/ziclix/python/sql/handler/InformixDataHandler.java branches/advanced/src/com/ziclix/python/sql/handler/MySQLDataHandler.java branches/advanced/src/com/ziclix/python/sql/handler/PostgresqlDataHandler.java branches/advanced/src/org/python/antlr/ExpressionParser.java branches/advanced/src/org/python/antlr/GrammarActions.java branches/advanced/src/org/python/antlr/InteractiveParser.java branches/advanced/src/org/python/antlr/PythonTokenSource.java branches/advanced/src/org/python/antlr/PythonTreeAdaptor.java branches/advanced/src/org/python/antlr/ast/ClassDef.java branches/advanced/src/org/python/antlr/ast/ErrorExpr.java branches/advanced/src/org/python/antlr/ast/ErrorMod.java branches/advanced/src/org/python/antlr/ast/ErrorSlice.java branches/advanced/src/org/python/antlr/ast/ErrorStmt.java branches/advanced/src/org/python/antlr/ast/VisitorBase.java branches/advanced/src/org/python/antlr/ast/VisitorIF.java branches/advanced/src/org/python/compiler/AdapterMaker.java branches/advanced/src/org/python/compiler/ArgListCompiler.java branches/advanced/src/org/python/compiler/ClassFile.java branches/advanced/src/org/python/compiler/Code.java branches/advanced/src/org/python/compiler/CodeCompiler.java branches/advanced/src/org/python/compiler/Constant.java branches/advanced/src/org/python/compiler/Future.java branches/advanced/src/org/python/compiler/JavaMaker.java branches/advanced/src/org/python/compiler/Module.java branches/advanced/src/org/python/compiler/ProxyMaker.java branches/advanced/src/org/python/compiler/ScopeInfo.java branches/advanced/src/org/python/compiler/ScopesCompiler.java branches/advanced/src/org/python/core/ArgParser.java branches/advanced/src/org/python/core/BytecodeLoader.java branches/advanced/src/org/python/core/ParserFacade.java branches/advanced/src/org/python/core/Py.java branches/advanced/src/org/python/core/PyArray.java branches/advanced/src/org/python/core/PyArrayDerived.java branches/advanced/src/org/python/core/PyBaseExceptionDerived.java branches/advanced/src/org/python/core/PyBeanEvent.java branches/advanced/src/org/python/core/PyBeanEventProperty.java branches/advanced/src/org/python/core/PyBooleanDerived.java branches/advanced/src/org/python/core/PyBuiltinFunction.java branches/advanced/src/org/python/core/PyBuiltinFunctionSet.java branches/advanced/src/org/python/core/PyBuiltinMethod.java branches/advanced/src/org/python/core/PyBuiltinMethodNarrow.java branches/advanced/src/org/python/core/PyBuiltinMethodSet.java branches/advanced/src/org/python/core/PyClass.java branches/advanced/src/org/python/core/PyClassMethodDerived.java branches/advanced/src/org/python/core/PyClassMethodDescr.java branches/advanced/src/org/python/core/PyComplexDerived.java branches/advanced/src/org/python/core/PyDictionary.java branches/advanced/src/org/python/core/PyDictionaryDerived.java branches/advanced/src/org/python/core/PyEnumerate.java branches/advanced/src/org/python/core/PyEnumerateDerived.java branches/advanced/src/org/python/core/PyFile.java branches/advanced/src/org/python/core/PyFileDerived.java branches/advanced/src/org/python/core/PyFloatDerived.java branches/advanced/src/org/python/core/PyFrozenSetDerived.java branches/advanced/src/org/python/core/PyFunction.java branches/advanced/src/org/python/core/PyGenerator.java branches/advanced/src/org/python/core/PyInstance.java branches/advanced/src/org/python/core/PyIntegerDerived.java branches/advanced/src/org/python/core/PyJavaClass.java branches/advanced/src/org/python/core/PyList.java branches/advanced/src/org/python/core/PyListDerived.java branches/advanced/src/org/python/core/PyLongDerived.java branches/advanced/src/org/python/core/PyMethodDescr.java branches/advanced/src/org/python/core/PyModuleDerived.java branches/advanced/src/org/python/core/PyNewWrapper.java branches/advanced/src/org/python/core/PyObject.java branches/advanced/src/org/python/core/PyObjectDerived.java branches/advanced/src/org/python/core/PyPropertyDerived.java branches/advanced/src/org/python/core/PySet.java branches/advanced/src/org/python/core/PySetDerived.java branches/advanced/src/org/python/core/PySlice.java branches/advanced/src/org/python/core/PySliceDerived.java branches/advanced/src/org/python/core/PyStringDerived.java branches/advanced/src/org/python/core/PyStringMap.java branches/advanced/src/org/python/core/PySuper.java branches/advanced/src/org/python/core/PySuperDerived.java branches/advanced/src/org/python/core/PySystemState.java branches/advanced/src/org/python/core/PyTableCode.java branches/advanced/src/org/python/core/PyTraceback.java branches/advanced/src/org/python/core/PyTupleDerived.java branches/advanced/src/org/python/core/PyType.java branches/advanced/src/org/python/core/PyTypeDerived.java branches/advanced/src/org/python/core/PyUnicode.java branches/advanced/src/org/python/core/PyUnicodeDerived.java branches/advanced/src/org/python/core/PyXRange.java branches/advanced/src/org/python/core/__builtin__.java branches/advanced/src/org/python/core/adapter/ClassicPyObjectAdapter.java branches/advanced/src/org/python/core/codecs.java branches/advanced/src/org/python/core/exceptions.java branches/advanced/src/org/python/core/imp.java branches/advanced/src/org/python/expose/generate/ExposeTask.java branches/advanced/src/org/python/expose/generate/ExposedMethodFinder.java branches/advanced/src/org/python/expose/generate/ExposedTypeProcessor.java branches/advanced/src/org/python/expose/generate/PyTypes.java branches/advanced/src/org/python/expose/generate/TypeExposer.java branches/advanced/src/org/python/modules/_collections/PyDefaultDict.java branches/advanced/src/org/python/modules/_collections/PyDefaultDictDerived.java branches/advanced/src/org/python/modules/_collections/PyDeque.java branches/advanced/src/org/python/modules/_collections/PyDequeDerived.java branches/advanced/src/org/python/modules/_csv/PyDialectDerived.java branches/advanced/src/org/python/modules/_functools/PyPartial.java branches/advanced/src/org/python/modules/_functools/PyPartialDerived.java branches/advanced/src/org/python/modules/_jython.java branches/advanced/src/org/python/modules/_weakref/ReferenceType.java branches/advanced/src/org/python/modules/_weakref/ReferenceTypeDerived.java branches/advanced/src/org/python/modules/binascii.java branches/advanced/src/org/python/modules/cPickle.java branches/advanced/src/org/python/modules/cStringIO.java branches/advanced/src/org/python/modules/operator.java branches/advanced/src/org/python/modules/random/PyRandom.java branches/advanced/src/org/python/modules/random/PyRandomDerived.java branches/advanced/src/org/python/modules/struct.java branches/advanced/src/org/python/modules/thread/PyLocalDerived.java branches/advanced/src/org/python/modules/time/Time.java branches/advanced/src/org/python/modules/zipimport/zipimporterDerived.java branches/advanced/src/org/python/util/jython.java branches/advanced/src/shell/jython branches/advanced/src/shell/jython.bat branches/advanced/src/templates/mappings branches/advanced/src/templates/object.derived branches/advanced/tests/java/org/python/antlr/PythonPartialTester.java branches/advanced/tests/java/org/python/expose/generate/ExposedTypeProcessorTest.java branches/advanced/tests/java/org/python/expose/generate/MethodExposerTest.java branches/advanced/tests/java/org/python/tests/VisibilityResults.java branches/advanced/tests/java/org/python/tests/Visible.java Added Paths: ----------- branches/advanced/Lib/test/eof_fodder1.py branches/advanced/Lib/test/eof_fodder2.py branches/advanced/Lib/test/eof_fodder3.py branches/advanced/Lib/test/eof_fodder4.py branches/advanced/Lib/test/eof_fodder5.py branches/advanced/Lib/test/eof_fodder6.py branches/advanced/Lib/test/test_StringIO_jy.py branches/advanced/Lib/test/test_asynchat.py branches/advanced/Lib/test/test_classdecorators.py branches/advanced/Lib/test/test_codeccallbacks.py branches/advanced/Lib/test/test_copy.py branches/advanced/Lib/test/test_eof_jy.py branches/advanced/Lib/test/test_evalorder.py branches/advanced/Lib/test/test_os.py branches/advanced/Lib/test/test_profilehooks.py branches/advanced/Lib/test/test_random.py branches/advanced/Lib/test/test_struct.py branches/advanced/Lib/test/test_trace.py branches/advanced/Lib/test/test_with.py branches/advanced/src/org/python/core/PyBuiltinCallable.java branches/advanced/src/org/python/core/PyBuiltinFunctionNarrow.java branches/advanced/src/org/python/expose/BaseTypeBuilder.java branches/advanced/src/org/python/modules/PyStruct.java branches/advanced/src/org/python/util/Generic.java branches/advanced/src/org/python/util/NameUnionAntType.java Removed Paths: ------------- branches/advanced/Lib/random.py branches/advanced/Lib/test/testtar.tar branches/advanced/bugtests/test049p/ branches/advanced/bugtests/test076.py branches/advanced/bugtests/test077.py branches/advanced/bugtests/test078.py branches/advanced/bugtests/test079.py branches/advanced/bugtests/test080.py branches/advanced/bugtests/test085.py branches/advanced/bugtests/test089.py branches/advanced/bugtests/test095.py branches/advanced/bugtests/test096.py branches/advanced/bugtests/test097.py branches/advanced/bugtests/test098.py branches/advanced/bugtests/test099.py branches/advanced/bugtests/test102.py branches/advanced/bugtests/test103.py branches/advanced/bugtests/test105.py branches/advanced/bugtests/test106.py branches/advanced/bugtests/test107.py branches/advanced/bugtests/test108.py branches/advanced/bugtests/test109.py branches/advanced/bugtests/test110.py branches/advanced/bugtests/test111.py branches/advanced/bugtests/test112.py branches/advanced/bugtests/test113.py branches/advanced/bugtests/test115.py branches/advanced/bugtests/test118.py branches/advanced/bugtests/test124.py branches/advanced/bugtests/test125.py branches/advanced/bugtests/test126.py branches/advanced/bugtests/test127.py branches/advanced/bugtests/test128.py branches/advanced/bugtests/test130.py branches/advanced/bugtests/test131.py branches/advanced/bugtests/test133.py branches/advanced/bugtests/test134.py branches/advanced/bugtests/test135.py branches/advanced/bugtests/test136.py branches/advanced/bugtests/test138.py branches/advanced/bugtests/test139.py branches/advanced/bugtests/test140.py branches/advanced/bugtests/test141.py branches/advanced/bugtests/test142.py branches/advanced/bugtests/test143.py branches/advanced/bugtests/test144.py branches/advanced/src/org/python/antlr/ast/Unicode.java branches/advanced/src/org/python/newcompiler/ Property Changed: ---------------- branches/advanced/ Property changes on: branches/advanced ___________________________________________________________________ Modified: svnmerge-integrated - /trunk/jython:1-5285 + /trunk/jython:1-5496 Modified: branches/advanced/.classpath =================================================================== --- branches/advanced/.classpath 2008-10-21 06:00:37 UTC (rev 5496) +++ branches/advanced/.classpath 2008-10-21 10:53:16 UTC (rev 5497) @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="lib" path="build/exposed"/> <classpathentry excluding="com/ziclix/python/sql/handler/InformixDataHandler.java|com/ziclix/python/sql/handler/OracleDataHandler.java" kind="src" output="build/classes" path="src"/> <classpathentry kind="src" output="build/classes" path="build/gensrc"/> <classpathentry kind="src" output="build/classes" path="tests/java"/> Modified: branches/advanced/CoreExposed.includes =================================================================== --- branches/advanced/CoreExposed.includes 2008-10-21 06:00:37 UTC (rev 5496) +++ branches/advanced/CoreExposed.includes 2008-10-21 10:53:16 UTC (rev 5497) @@ -2,7 +2,7 @@ org/python/core/PyBaseString.class org/python/core/PyBaseException.class org/python/core/PyBoolean.class -org/python/core/PyBuiltinFunction.class +org/python/core/PyBuiltinCallable.class org/python/core/PyCell.class org/python/core/PyClassMethod.class org/python/core/PyClassMethodDescr.class @@ -52,4 +52,5 @@ org/python/modules/thread/PyLocal.class org/python/modules/time/PyTimeTuple.class org/python/modules/zipimport/zipimporter.class +org/python/modules/PyStruct.class org/python/modules/PyTeeIterator.class Modified: branches/advanced/Lib/javapath.py =================================================================== --- branches/advanced/Lib/javapath.py 2008-10-21 06:00:37 UTC (rev 5496) +++ branches/advanced/Lib/javapath.py 2008-10-21 10:53:16 UTC (rev 5497) @@ -20,7 +20,9 @@ from java.lang import System import os +from org.python.core.Py import newString as asPyString + def _tostr(s, method): if isinstance(s, basestring): return s @@ -40,7 +42,7 @@ def dirname(path): """Return the directory component of a pathname""" path = _tostr(path, "dirname") - result = File(path).getParent() + result = asPyString(File(path).getParent()) if not result: if isabs(path): result = path # Must be root @@ -51,7 +53,7 @@ def basename(path): """Return the final component of a pathname""" path = _tostr(path, "basename") - return File(path).getName() + return asPyString(File(path).getName()) def split(path): """Split a pathname. @@ -128,7 +130,7 @@ if a == "": a = os.sep f = File(f, a) - return f.getPath() + return asPyString(f.getPath()) def normcase(path): """Normalize case of pathname. @@ -137,7 +139,7 @@ """ path = _tostr(path, "normcase") - return File(path).getPath() + return asPyString(File(path).getPath()) def commonprefix(m): "Given a list of pathnames, return the longest common leading component" @@ -197,7 +199,7 @@ if not c: return gethome() if c == os.sep: - return File(gethome(), path[2:]).getPath() + return asPyString(File(gethome(), path[2:]).getPath()) return path def getuser(): @@ -252,7 +254,7 @@ def _abspath(path): # Must use normpath separately because getAbsolutePath doesn't normalize # and getCanonicalPath would eliminate symlinks. - return normpath(File(sys.getPath(path)).getAbsolutePath()) + return normpath(asPyString(File(sys.getPath(path)).getAbsolutePath())) def realpath(path): """Return an absolute path normalized and symbolic links eliminated""" @@ -261,7 +263,7 @@ def _realpath(path): try: - return File(sys.getPath(path)).getCanonicalPath() + return asPyString(File(sys.getPath(path)).getCanonicalPath()) except java.io.IOException: return _abspath(path) Modified: branches/advanced/Lib/os.py =================================================================== --- branches/advanced/Lib/os.py 2008-10-21 06:00:37 UTC (rev 5496) +++ branches/advanced/Lib/os.py 2008-10-21 10:53:16 UTC (rev 5497) @@ -48,6 +48,7 @@ from java.io import File from org.python.core import PyFile from org.python.core.io import FileDescriptors, FileIO, IOBase +from org.python.core.Py import newString as asPyString # Mapping of: os._name: [name list, shell command list] _os_map = dict(nt=[ @@ -205,15 +206,15 @@ if i < 0 or i > 9: raise IndexError(i) return getattr(self, stat_result._stat_members[i][0]) - + def __setitem__(self, x, value): raise TypeError("object doesn't support item assignment") - + def __setattr__(self, name, value): if name in [x[0] for x in stat_result._stat_members]: raise TypeError(name) raise AttributeError("readonly attribute") - + def __len__(self): return 10 @@ -264,7 +265,7 @@ l = File(sys.getPath(path)).list() if l is None: raise OSError(0, 'No such directory', path) - return list(l) + return [asPyString(entry) for entry in l] def chmod(path, mode): """chmod(path, mode) @@ -303,14 +304,14 @@ # if making a /x/y/z/., java.io.File#mkdirs inexplicably fails. So we need # to force it - + # need to use _path instead of path, because param is hiding # os.path module in namespace! head, tail = _path.split(sys_path) if tail == curdir: if File(_path.join(head)).mkdirs(): return - + raise OSError(0, "couldn't make directories", path) def remove(path): @@ -362,7 +363,12 @@ """rmdir(path) Remove a directory.""" - if not File(sys.getPath(path)).delete(): + f = File(sys.getPath(path)) + if not f.exists(): + raise OSError(errno.ENOENT, errno.strerror(errno.ENOENT), path) + elif not f.isDirectory(): + raise OSError(errno.ENOTDIR, errno.strerror(errno.ENOTDIR), path) + elif not f.delete(): raise OSError(0, "couldn't delete directory", path) #XXX: copied from CPython 2.5.1 @@ -392,7 +398,7 @@ def strerror(code): """strerror(code) -> string - + Translate an error code to a message string. """ if not isinstance(code, (int, long)): @@ -404,7 +410,7 @@ def access(path, mode): """access(path, mode) -> True if granted, False otherwise - + Use the real uid/gid to test for access to a path. Note that most operations will use the effective uid/gid, therefore this routine can be used in a suid/sgid environment to test if the invoking user has the @@ -415,15 +421,20 @@ raise TypeError('an integer is required') f = File(sys.getPath(path)) + result = True if not f.exists(): - return False + result = False if mode & R_OK and not f.canRead(): - return False + result = False if mode & W_OK and not f.canWrite(): - return False + result = False if mode & X_OK: - return False - return True + # NOTE: always False without jna-posix stat + try: + result = (stat(path).st_mode & _stat.S_IEXEC) != 0 + except OSError: + result = False + return result def stat(path): """stat(path) -> stat result @@ -458,7 +469,7 @@ def lstat(path): """lstat(path) -> stat result - + Like stat(path), but do not follow symbolic links. """ abs_path = sys.getPath(path) @@ -545,7 +556,7 @@ """ftruncate(fd, length) Truncate a file to a specified length. - """ + """ rawio = FileDescriptors.get(fd) try: rawio.truncate(length) @@ -624,7 +635,7 @@ from org.python.core.util import StringUtil rawio = FileDescriptors.get(fd) buf = _handle_oserror(rawio.read, buffersize) - return str(StringUtil.fromBytes(buf)) + return asPyString(StringUtil.fromBytes(buf)) def write(fd, string): """write(fd, string) -> byteswritten @@ -647,7 +658,7 @@ if _name == 'posix' and _native_posix: def link(src, dst): """link(src, dst) - + Create a hard link to a file. """ _posix.link(sys.getPath(src), sys.getPath(dst)) @@ -661,7 +672,7 @@ def readlink(path): """readlink(path) -> path - + Return a string representing the path to which the symbolic link points. """ @@ -863,7 +874,7 @@ def putenv(key, value): """putenv(key, value) - + Change or add an environment variable. """ environ[key] = value Deleted: branches/advanced/Lib/random.py =================================================================== --- branches/advanced/Lib/random.py 2008-10-21 06:00:37 UTC (rev 5496) +++ branches/advanced/Lib/random.py 2008-10-21 10:53:16 UTC (rev 5497) @@ -1,863 +0,0 @@ -"""Random variable generators. - - integers - -------- - uniform within range - - sequences - --------- - pick random element - pick random sample - generate random permutation - - distributions on the real line: - ------------------------------ - uniform - normal (Gaussian) - lognormal - negative exponential - gamma - beta - pareto - Weibull - - distributions on the circle (angles 0 to 2pi) - --------------------------------------------- - circular uniform - ... [truncated message content] |