From: <otm...@us...> - 2011-02-14 22:09:55
|
Revision: 7199 http://jython.svn.sourceforge.net/jython/?rev=7199&view=rev Author: otmarhumbel Date: 2011-02-14 22:09:48 +0000 (Mon, 14 Feb 2011) Log Message: ----------- prepare for 2.5.2rc4 Modified Paths: -------------- trunk/jython/NEWS trunk/jython/README.txt trunk/jython/build.xml Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-02-13 20:49:57 UTC (rev 7198) +++ trunk/jython/NEWS 2011-02-14 22:09:48 UTC (rev 7199) @@ -1,12 +1,13 @@ Jython NEWS -Jython 2.5.2 +Jython 2.5.2rc4 Bugs Fixed - [ 1667 ] thread.local subclasses with constructor params fail - [ 1698 ] warnings module fails under JSR-223 - [ 1697 ] Wrong error message when http connection can not be established - [ 1210 ] Lib/socket.py doesn't allow IPv6 sockets and fails with an AssertionError - [ 1700 ] "virtualenv is not compatible" to 2.5.2rc3 + - [ 1701 ] Files are not flushed properly when opened from the EDT (partial fix) Jython 2.5.2rc3 Bugs Fixed Modified: trunk/jython/README.txt =================================================================== --- trunk/jython/README.txt 2011-02-13 20:49:57 UTC (rev 7198) +++ trunk/jython/README.txt 2011-02-14 22:09:48 UTC (rev 7199) @@ -1,9 +1,9 @@ -Welcome to Jython 2.5.2 rc3 +Welcome to Jython 2.5.2 rc4 =========================== -This is the third release candidate of the 2.5.2 version of Jython. -It contains the most important bug fixes since 2.5.2 rc2. -We believe that this is the last release candidate before the final 2.5.2 release! +This is the fourth release candidate of the 2.5.2 version of Jython. +It contains the fixes of the blocker bugs since 2.5.2 rc3. +We still believe that this is the last release candidate before the final 2.5.2 release! This release fixes bugs related to resource leaks, Java integration, and a number of other issues. See the NEWS file for more details. In Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2011-02-13 20:49:57 UTC (rev 7198) +++ trunk/jython/build.xml 2011-02-14 22:09:48 UTC (rev 7199) @@ -123,13 +123,13 @@ <property name="PY_RELEASE_LEVEL_SNAPSHOT" value="170"/> <!-- 0xAA --> <!-- The current version info --> - <property name="jython.version" value="2.5.2rc3"/> - <property name="jython.version.noplus" value="2.5.2rc3"/> + <property name="jython.version" value="2.5.2rc4"/> + <property name="jython.version.noplus" value="2.5.2rc4"/> <property name="jython.major_version" value="2"/> <property name="jython.minor_version" value="5"/> <property name="jython.micro_version" value="2"/> <property name="jython.release_level" value="${PY_RELEASE_LEVEL_GAMMA}"/> - <property name="jython.release_serial" value="3"/> + <property name="jython.release_serial" value="4"/> <condition property="do.snapshot.build"> <isset property="snapshot.revision" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2011-03-01 21:54:19
|
Revision: 7203 http://jython.svn.sourceforge.net/jython/?rev=7203&view=rev Author: otmarhumbel Date: 2011-03-01 21:54:13 +0000 (Tue, 01 Mar 2011) Log Message: ----------- prepare for 2.5.2 final Modified Paths: -------------- trunk/jython/NEWS trunk/jython/README.txt trunk/jython/build.xml Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-02-15 21:39:44 UTC (rev 7202) +++ trunk/jython/NEWS 2011-03-01 21:54:13 UTC (rev 7203) @@ -1,5 +1,8 @@ Jython NEWS +Jython 2.5.2 + same as 2.5.2rc4 + Jython 2.5.2rc4 Bugs Fixed - [ 1667 ] thread.local subclasses with constructor params fail Modified: trunk/jython/README.txt =================================================================== --- trunk/jython/README.txt 2011-02-15 21:39:44 UTC (rev 7202) +++ trunk/jython/README.txt 2011-03-01 21:54:13 UTC (rev 7203) @@ -1,9 +1,8 @@ -Welcome to Jython 2.5.2 rc4 -=========================== +Welcome to Jython 2.5.2 +======================= -This is the fourth release candidate of the 2.5.2 version of Jython. -It contains the fixes of the blocker bugs since 2.5.2 rc3. -We still believe that this is the last release candidate before the final 2.5.2 release! +This is the final 2.5.2 release of Jython. +It contains the fixes of the blocker bugs since 2.5.2 release candidate 3. This release fixes bugs related to resource leaks, Java integration, and a number of other issues. See the NEWS file for more details. In Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2011-02-15 21:39:44 UTC (rev 7202) +++ trunk/jython/build.xml 2011-03-01 21:54:13 UTC (rev 7203) @@ -123,13 +123,13 @@ <property name="PY_RELEASE_LEVEL_SNAPSHOT" value="170"/> <!-- 0xAA --> <!-- The current version info --> - <property name="jython.version" value="2.5.2rc4"/> - <property name="jython.version.noplus" value="2.5.2rc4"/> + <property name="jython.version" value="2.5.2"/> + <property name="jython.version.noplus" value="2.5.2"/> <property name="jython.major_version" value="2"/> <property name="jython.minor_version" value="5"/> <property name="jython.micro_version" value="2"/> - <property name="jython.release_level" value="${PY_RELEASE_LEVEL_GAMMA}"/> - <property name="jython.release_serial" value="4"/> + <property name="jython.release_level" value="${PY_RELEASE_LEVEL_FINAL}"/> + <property name="jython.release_serial" value="0"/> <condition property="do.snapshot.build"> <isset property="snapshot.revision" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2011-03-12 19:36:35
|
Revision: 7218 http://jython.svn.sourceforge.net/jython/?rev=7218&view=rev Author: fwierzbicki Date: 2011-03-12 19:36:22 +0000 (Sat, 12 Mar 2011) Log Message: ----------- First cut at Python.g grammar + associated fixes. The with statement is on by default. Passes test_grammar from Python 2.6. Modified Paths: -------------- trunk/jython/Lib/test/test_func_syntax_jy.py trunk/jython/grammar/Python.g trunk/jython/src/org/python/Version.java trunk/jython/src/org/python/antlr/GrammarActions.java trunk/jython/src/org/python/core/Options.java trunk/jython/src/org/python/core/Py.java trunk/jython/src/org/python/core/PySystemState.java trunk/jython/src/org/python/core/exceptions.java trunk/jython/src/org/python/indexer/Builtins.java Modified: trunk/jython/Lib/test/test_func_syntax_jy.py =================================================================== --- trunk/jython/Lib/test/test_func_syntax_jy.py 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/Lib/test/test_func_syntax_jy.py 2011-03-12 19:36:22 UTC (rev 7218) @@ -10,7 +10,7 @@ "parrot(voltage=.5, \'dead\')") def test_dup_keywords(self): - self.assertRaises(TypeError, eval, + self.assertRaises(SyntaxError, eval, "complex(imag=4, imag=2)") def test_main(): Modified: trunk/jython/grammar/Python.g =================================================================== --- trunk/jython/grammar/Python.g 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/grammar/Python.g 2011-03-12 19:36:22 UTC (rev 7218) @@ -991,12 +991,13 @@ : (AS | NAME) expr[expr_contextType.Store] { $etype = actions.castExpr($expr.tree); + actions.checkAssign($etype); } ; -//except_clause: 'except' [test [',' test]] +//except_clause: 'except' [test [('as' | ',') test]] except_clause - : EXCEPT (t1=test[expr_contextType.Load] (COMMA t2=test[expr_contextType.Store])?)? COLON suite[!$suite.isEmpty() && $suite::continueIllegal] + : EXCEPT (t1=test[expr_contextType.Load] ((COMMA | AS) t2=test[expr_contextType.Store])?)? COLON suite[!$suite.isEmpty() && $suite::continueIllegal] -> ^(EXCEPT<ExceptHandler>[$EXCEPT, actions.castExpr($t1.tree), actions.castExpr($t2.tree), actions.castStmts($suite.stypes)]) ; @@ -1639,7 +1640,9 @@ } ; -//arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) +//arglist: (argument ',')* (argument [','] +// |'*' test (',' argument)* [',' '**' test] +// |'**' test) arglist returns [List args, List keywords, expr starargs, expr kwargs] @init { @@ -1647,9 +1650,9 @@ List kws = new ArrayList(); List gens = new ArrayList(); } - : argument[arguments, kws, gens, true] (COMMA argument[arguments, kws, gens, false])* + : argument[arguments, kws, gens, true, false] (COMMA argument[arguments, kws, gens, false, false])* (COMMA - ( STAR s=test[expr_contextType.Load] (COMMA DOUBLESTAR k=test[expr_contextType.Load])? + ( STAR s=test[expr_contextType.Load] (COMMA argument[arguments, kws, gens, false, true])* (COMMA DOUBLESTAR k=test[expr_contextType.Load])? | DOUBLESTAR k=test[expr_contextType.Load] )? )? @@ -1662,25 +1665,37 @@ $starargs=actions.castExpr($s.tree); $kwargs=actions.castExpr($k.tree); } - | STAR s=test[expr_contextType.Load] (COMMA DOUBLESTAR k=test[expr_contextType.Load])? + | STAR s=test[expr_contextType.Load] (COMMA argument[arguments, kws, gens, false, true])* (COMMA DOUBLESTAR k=test[expr_contextType.Load])? { $starargs=actions.castExpr($s.tree); - $kwargs=actions.castExpr($k.tree); + $keywords=kws; + $kwargs=actions.castExpr($k.tree); } | DOUBLESTAR k=test[expr_contextType.Load] { - $kwargs=actions.castExpr($k.tree); + $kwargs=actions.castExpr($k.tree); } ; //argument: test [gen_for] | test '=' test # Really [keyword '='] test argument - [List arguments, List kws, List gens, boolean first] returns [boolean genarg] + [List arguments, List kws, List gens, boolean first, boolean afterStar] returns [boolean genarg] : t1=test[expr_contextType.Load] ((ASSIGN t2=test[expr_contextType.Load]) { + expr newkey = actions.castExpr($t1.tree); + //Loop through all current keys and fail on duplicate. + for(Object o: $kws) { + List list = (List)o; + Object oldkey = list.get(0); + if (oldkey instanceof Name && newkey instanceof Name) { + if (((Name)oldkey).getId().equals(((Name)newkey).getId())) { + errorHandler.error("keyword arguments repeated", $t1.tree); + } + } + } List<expr> exprs = new ArrayList<expr>(); - exprs.add(actions.castExpr($t1.tree)); + exprs.add(newkey); exprs.add(actions.castExpr($t2.tree)); $kws.add(exprs); } @@ -1698,6 +1713,8 @@ { if (kws.size() > 0) { errorHandler.error("non-keyword arg after keyword arg", $t1.tree); + } else if (afterStar) { + errorHandler.error("only named arguments may follow *expression", $t1.tree); } $arguments.add($t1.tree); } @@ -1905,9 +1922,13 @@ INT : // Hex '0' ('x' | 'X') ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ | // Octal - '0' ( '0' .. '7' )* - | '1'..'9' DIGITS* - ; + '0' ('o' | 'O') ( '0' .. '7' )* + | '0' ( '0' .. '7' )* + | // Binary + '0' ('b' | 'B') ( '0' .. '1' )* + | // Decimal + '1'..'9' DIGITS* +; COMPLEX : DIGITS+ ('j'|'J') @@ -1925,7 +1946,7 @@ * should make us exit loop not continue. */ STRING - : ('r'|'u'|'ur'|'R'|'U'|'UR'|'uR'|'Ur')? + : ('r'|'u'|'b'|'ur'|'R'|'U'|'B'|'UR'|'uR'|'Ur')? ( '\'\'\'' (options {greedy=false;}:TRIAPOS)* '\'\'\'' | '"""' (options {greedy=false;}:TRIQUOTE)* '"""' | '"' (ESC|~('\\'|'\n'|'"'))* '"' Modified: trunk/jython/src/org/python/Version.java =================================================================== --- trunk/jython/src/org/python/Version.java 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/src/org/python/Version.java 2011-03-12 19:36:22 UTC (rev 7218) @@ -44,7 +44,7 @@ /** The flags that are set by default in a code object. */ private static final Collection<CodeFlag> defaultCodeFlags = Arrays.asList( - CodeFlag.CO_NESTED, CodeFlag.CO_GENERATOR_ALLOWED); + CodeFlag.CO_NESTED, CodeFlag.CO_GENERATOR_ALLOWED, CodeFlag.CO_FUTURE_WITH_STATEMENT); private static final String headURL = "$HeadURL$"; Modified: trunk/jython/src/org/python/antlr/GrammarActions.java =================================================================== --- trunk/jython/src/org/python/antlr/GrammarActions.java 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/src/org/python/antlr/GrammarActions.java 2011-03-12 19:36:22 UTC (rev 7218) @@ -347,20 +347,22 @@ } List<keyword> makeKeywords(List args) { - List<keyword> k = new ArrayList<keyword>(); + List<keyword> keywords = new ArrayList<keyword>(); if (args != null) { - for(int i=0;i<args.size();i++) { - List e = (List)args.get(i); - checkAssign(castExpr(e.get(0))); - if (e.get(0) instanceof Name) { - Name arg = (Name)e.get(0); - k.add(new keyword(arg, arg.getInternalId(), castExpr(e.get(1)))); + for (Object o : args) { + List e = (List)o; + Object k = e.get(0); + Object v = e.get(1); + checkAssign(castExpr(k)); + if (k instanceof Name) { + Name arg = (Name)k; + keywords.add(new keyword(arg, arg.getInternalId(), castExpr(v))); } else { - errorHandler.error("keyword must be a name", (PythonTree)e.get(0)); + errorHandler.error("keyword must be a name", (PythonTree)k); } } } - return k; + return keywords; } Object makeFloat(Token t) { @@ -373,12 +375,21 @@ return Py.newImaginary(Double.valueOf(s)); } + //XXX: needs to handle NumberFormatException (on input like 0b2) and needs + // a better long guard than ndigits > 11 (this is much to short for + // binary for example) Object makeInt(Token t) { String s = t.getText(); int radix = 10; if (s.startsWith("0x") || s.startsWith("0X")) { radix = 16; s = s.substring(2, s.length()); + } else if (s.startsWith("0o") || s.startsWith("0O")) { + radix = 8; + s = s.substring(2, s.length()); + } else if (s.startsWith("0b") || s.startsWith("0B")) { + radix = 2; + s = s.substring(2, s.length()); } else if (s.startsWith("0")) { radix = 8; } Modified: trunk/jython/src/org/python/core/Options.java =================================================================== --- trunk/jython/src/org/python/core/Options.java 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/src/org/python/core/Options.java 2011-03-12 19:36:22 UTC (rev 7218) @@ -75,7 +75,11 @@ /** Force stdin, stdout and stderr to be unbuffered, and opened in * binary mode */ public static boolean unbuffered = false; + + //XXX: place holder + public static int bytes_warning = 0; + /** * Enable division warning. The value maps to the registry values of * <ul> Modified: trunk/jython/src/org/python/core/Py.java =================================================================== --- trunk/jython/src/org/python/core/Py.java 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/src/org/python/core/Py.java 2011-03-12 19:36:22 UTC (rev 7218) @@ -402,6 +402,11 @@ public static void UnicodeWarning(String message) { warning(UnicodeWarning, message); } + + public static PyObject BytesWarning; + public static void BytesWarning(String message) { + warning(BytesWarning, message); + } private static PyObject warnings_mod; @@ -775,6 +780,7 @@ FutureWarning = initExc("FutureWarning", exc, dict); ImportWarning = initExc("ImportWarning", exc, dict); UnicodeWarning = initExc("UnicodeWarning", exc, dict); + BytesWarning = initExc("BytesWarning", exc, dict); // Pre-initialize the PyJavaClass for OutOfMemoryError so when we need // it it creating the pieces for it won't cause an additional out of Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/src/org/python/core/PySystemState.java 2011-03-12 19:36:22 UTC (rev 7218) @@ -65,6 +65,16 @@ public static PyTuple version_info; public final static int maxunicode = 1114111; + + //XXX: we should someday make this Long.MAX_VALUE, but see test_index.py + // for tests that would need to pass but today would not. + public final static int maxsize = Integer.MAX_VALUE; + + //XXX: place holder + public final static boolean py3kwarning = false; + + public final static Class flags = Options.class; + public static PyTuple subversion; /** * The copyright notice for this release. Modified: trunk/jython/src/org/python/core/exceptions.java =================================================================== --- trunk/jython/src/org/python/core/exceptions.java 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/src/org/python/core/exceptions.java 2011-03-12 19:36:22 UTC (rev 7218) @@ -166,6 +166,10 @@ buildClass(dict, "UnicodeWarning", "Warning", "Base class for warnings about Unicode related problems, mostly\n" + "related to conversion problems."); + + buildClass(dict, "BytesWarning", "Warning", + "Base class for warnings about bytes and buffer related problems, mostly\n" + + "related to conversion from str or comparing to str."); // Initialize ZipImportError here, where it's safe to; it's // needed immediately Modified: trunk/jython/src/org/python/indexer/Builtins.java =================================================================== --- trunk/jython/src/org/python/indexer/Builtins.java 2011-03-12 19:30:30 UTC (rev 7217) +++ trunk/jython/src/org/python/indexer/Builtins.java 2011-03-12 19:36:22 UTC (rev 7218) @@ -99,8 +99,8 @@ Scope moduleTable; String[] builtin_exception_types = { - "ArithmeticError", "AssertionError", "AttributeError", - "BaseException", "Exception", "DeprecationWarning", "EOFError", + "ArithmeticError", "AssertionError", "AttributeError", "BaseException", + "BytesWarning", "Exception", "DeprecationWarning", "EOFError", "EnvironmentError", "FloatingPointError", "FutureWarning", "GeneratorExit", "IOError", "ImportError", "ImportWarning", "IndentationError", "IndexError", "KeyError", "KeyboardInterrupt", @@ -108,11 +108,10 @@ "NotImplementedError", "OSError", "OverflowError", "PendingDeprecationWarning", "ReferenceError", "RuntimeError", "RuntimeWarning", "StandardError", "StopIteration", "SyntaxError", - "SyntaxWarning", "SystemError", "SystemExit", "TabError", - "TypeError", "UnboundLocalError", "UnicodeDecodeError", - "UnicodeEncodeError", "UnicodeError", "UnicodeTranslateError", - "UnicodeWarning", "UserWarning", "ValueError", "Warning", - "ZeroDivisionError" + "SyntaxWarning", "SystemError", "SystemExit", "TabError", "TypeError", + "UnboundLocalError", "UnicodeDecodeError", "UnicodeEncodeError", + "UnicodeError", "UnicodeTranslateError", "UnicodeWarning", + "UserWarning", "ValueError", "Warning", "ZeroDivisionError" }; Set<NType> nativeTypes = new HashSet<NType>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2011-03-13 03:32:58
|
Revision: 7221 http://jython.svn.sourceforge.net/jython/?rev=7221&view=rev Author: fwierzbicki Date: 2011-03-13 03:32:51 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Switching to CPython 2.6 Lib + get regrtest to at least have lots of fail instead of just crashing outright. Modified Paths: -------------- trunk/jython/Lib/socket.py trunk/jython/Lib/test/regrtest.py trunk/jython/src/org/python/core/__builtin__.java trunk/jython/src/org/python/modules/_functools/_functools.java Property Changed: ---------------- trunk/jython/ Property changes on: trunk/jython ___________________________________________________________________ Modified: svn:externals - CPythonLib -r70085 https://svn.python.org/projects/python/branches/release25-maint/Lib/ + CPythonLib -r88766 https://svn.python.org/projects/python/branches/release26-maint/Lib/ Modified: trunk/jython/Lib/socket.py =================================================================== --- trunk/jython/Lib/socket.py 2011-03-12 20:13:35 UTC (rev 7220) +++ trunk/jython/Lib/socket.py 2011-03-13 03:32:51 UTC (rev 7221) @@ -1506,6 +1506,7 @@ raise StopIteration return line +_GLOBAL_DEFAULT_TIMEOUT = object() # Define the SSL support Modified: trunk/jython/Lib/test/regrtest.py =================================================================== --- trunk/jython/Lib/test/regrtest.py 2011-03-12 20:13:35 UTC (rev 7220) +++ trunk/jython/Lib/test/regrtest.py 2011-03-13 03:32:51 UTC (rev 7221) @@ -553,11 +553,12 @@ else: cfp = cStringIO.StringIO() + from test.junit_xml import Tee, write_direct_test try: save_stdout = sys.stdout + + indirect_test = None if junit_xml_dir: - from test.junit_xml import Tee, write_direct_test - indirect_test = None save_stderr = sys.stderr sys.stdout = stdout = Tee(sys.stdout) sys.stderr = stderr = Tee(sys.stderr) @@ -1445,6 +1446,15 @@ test_winreg test_winsound test_zipfile64 + + test_gzip + test_ftplib + test_logging + test_poplib + test_pydoc + test_queue + test_smtplib + test_telnetlib """ } _expectations['freebsd5'] = _expectations['freebsd4'] Modified: trunk/jython/src/org/python/core/__builtin__.java =================================================================== --- trunk/jython/src/org/python/core/__builtin__.java 2011-03-12 20:13:35 UTC (rev 7220) +++ trunk/jython/src/org/python/core/__builtin__.java 2011-03-13 03:32:51 UTC (rev 7221) @@ -15,6 +15,8 @@ import org.python.antlr.base.mod; import org.python.core.util.RelativeFile; +import org.python.modules._functools._functools; + class BuiltinFunctions extends PyBuiltinFunctionSet { public static final PyObject module = Py.newString("__builtin__"); @@ -167,7 +169,7 @@ case 33: return __builtin__.pow(arg1, arg2); case 35: - return __builtin__.reduce(arg1, arg2); + return _functools.reduce(arg1, arg2); case 29: return fancyCall(new PyObject[] {arg1, arg2}); case 30: @@ -209,7 +211,7 @@ case 33: return __builtin__.pow(arg1, arg2, arg3); case 35: - return __builtin__.reduce(arg1, arg2, arg3); + return _functools.reduce(arg1, arg2, arg3); case 39: __builtin__.setattr(arg1, arg2, arg3); return Py.None; Modified: trunk/jython/src/org/python/modules/_functools/_functools.java =================================================================== --- trunk/jython/src/org/python/modules/_functools/_functools.java 2011-03-12 20:13:35 UTC (rev 7220) +++ trunk/jython/src/org/python/modules/_functools/_functools.java 2011-03-13 03:32:51 UTC (rev 7221) @@ -21,4 +21,35 @@ // Hide from Python dict.__setitem__("classDictInit", null); } + + public static PyString __doc__reduce = new PyString( + "reduce(function, sequence[, initial]) -> value\n\n" + + "Apply a function of two arguments cumulatively to the items of a sequence,\n" + + "from left to right, so as to reduce the sequence to a single value.\n" + + "For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n" + + "((((1+2)+3)+4)+5). If initial is present, it is placed before the items\n" + + "of the sequence in the calculation, and serves as a default when the\n" + + "sequence is empty."); + + public static PyObject reduce(PyObject f, PyObject l, PyObject z) { + PyObject result = z; + PyObject iter = Py.iter(l, "reduce() arg 2 must support iteration"); + + for (PyObject item; (item = iter.__iternext__()) != null;) { + if (result == null) { + result = item; + } else { + result = f.__call__(result, item); + } + } + if (result == null) { + throw Py.TypeError("reduce of empty sequence with no initial value"); + } + return result; + } + + public static PyObject reduce(PyObject f, PyObject l) { + return reduce(f, l, null); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-14 16:54:21
|
Revision: 7238 http://jython.svn.sourceforge.net/jython/?rev=7238&view=rev Author: pjenvey Date: 2011-03-14 16:54:14 +0000 (Mon, 14 Mar 2011) Log Message: ----------- more includes for 2.6. I think this is all of them except abc/_abcoll/io/ssl Modified Paths: -------------- trunk/jython/CPythonLib.includes Removed Paths: ------------- trunk/jython/Lib/ast.py Modified: trunk/jython/CPythonLib.includes =================================================================== --- trunk/jython/CPythonLib.includes 2011-03-14 16:30:18 UTC (rev 7237) +++ trunk/jython/CPythonLib.includes 2011-03-14 16:54:14 UTC (rev 7238) @@ -18,6 +18,7 @@ _threading_local.py aifc.py anydbm.py +ast.py atexit.py asynchat.py BaseHTTPServer.py @@ -59,8 +60,10 @@ fnmatch.py formatter.py fpformat.py +fractions.py ftplib.py functools.py +genericpath.py getopt.py glob.py gopherlib.py @@ -91,6 +94,7 @@ multifile.py mutex.py nntplib.py +numbers.py nturl2path.py opcode.py optparse.py @@ -98,12 +102,14 @@ pickle.py pickletools.py pipes.py +plistlib.py poplib.py posixfile.py pprint.py profile.py pstats.py pyclbr.py +pydoc_topics.py Queue.py quopri.py random.py Deleted: trunk/jython/Lib/ast.py =================================================================== --- trunk/jython/Lib/ast.py 2011-03-14 16:30:18 UTC (rev 7237) +++ trunk/jython/Lib/ast.py 2011-03-14 16:54:14 UTC (rev 7238) @@ -1,301 +0,0 @@ -# -*- coding: utf-8 -*- -""" - ast - ~~~ - - The `ast` module helps Python applications to process trees of the Python - abstract syntax grammar. The abstract syntax itself might change with - each Python release; this module helps to find out programmatically what - the current grammar looks like and allows modifications of it. - - An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as - a flag to the `compile()` builtin function or by using the `parse()` - function from this module. The result will be a tree of objects whose - classes all inherit from `ast.AST`. - - A modified abstract syntax tree can be compiled into a Python code object - using the built-in `compile()` function. - - Additionally various helper functions are provided that make working with - the trees simpler. The main intention of the helper functions and this - module in general is to provide an easy to use interface for libraries - that work tightly with the python syntax (template engines for example). - - - :copyright: Copyright 2008 by Armin Ronacher. - :license: Python License. -""" -from _ast import * -from _ast import __version__ - - -def parse(expr, filename='<unknown>', mode='exec'): - """ - Parse an expression into an AST node. - Equivalent to compile(expr, filename, mode, PyCF_ONLY_AST). - """ - return compile(expr, filename, mode, PyCF_ONLY_AST) - - -def literal_eval(node_or_string): - """ - Safely evaluate an expression node or a string containing a Python - expression. The string or node provided may only consist of the following - Python literal structures: strings, numbers, tuples, lists, dicts, booleans, - and None. - """ - _safe_names = {'None': None, 'True': True, 'False': False} - if isinstance(node_or_string, basestring): - node_or_string = parse(node_or_string, mode='eval') - if isinstance(node_or_string, Expression): - node_or_string = node_or_string.body - def _convert(node): - if isinstance(node, Str): - return node.s - elif isinstance(node, Num): - return node.n - elif isinstance(node, Tuple): - return tuple(map(_convert, node.elts)) - elif isinstance(node, List): - return list(map(_convert, node.elts)) - elif isinstance(node, Dict): - return dict((_convert(k), _convert(v)) for k, v - in zip(node.keys, node.values)) - elif isinstance(node, Name): - if node.id in _safe_names: - return _safe_names[node.id] - raise ValueError('malformed string') - return _convert(node_or_string) - - -def dump(node, annotate_fields=True, include_attributes=False): - """ - Return a formatted dump of the tree in *node*. This is mainly useful for - debugging purposes. The returned string will show the names and the values - for fields. This makes the code impossible to evaluate, so if evaluation is - wanted *annotate_fields* must be set to False. Attributes such as line - numbers and column offsets are not dumped by default. If this is wanted, - *include_attributes* can be set to True. - """ - def _format(node): - if isinstance(node, AST): - fields = [(a, _format(b)) for a, b in iter_fields(node)] - rv = '%s(%s' % (node.__class__.__name__, ', '.join( - ('%s=%s' % field for field in fields) - if annotate_fields else - (b for a, b in fields) - )) - if include_attributes and node._attributes: - rv += fields and ', ' or ' ' - rv += ', '.join('%s=%s' % (a, _format(getattr(node, a))) - for a in node._attributes) - return rv + ')' - elif isinstance(node, list): - return '[%s]' % ', '.join(_format(x) for x in node) - return repr(node) - if not isinstance(node, AST): - raise TypeError('expected AST, got %r' % node.__class__.__name__) - return _format(node) - - -def copy_location(new_node, old_node): - """ - Copy source location (`lineno` and `col_offset` attributes) from - *old_node* to *new_node* if possible, and return *new_node*. - """ - for attr in 'lineno', 'col_offset': - if attr in old_node._attributes and attr in new_node._attributes \ - and hasattr(old_node, attr): - setattr(new_node, attr, getattr(old_node, attr)) - return new_node - - -def fix_missing_locations(node): - """ - When you compile a node tree with compile(), the compiler expects lineno and - col_offset attributes for every node that supports them. This is rather - tedious to fill in for generated nodes, so this helper adds these attributes - recursively where not already set, by setting them to the values of the - parent node. It works recursively starting at *node*. - """ - def _fix(node, lineno, col_offset): - if 'lineno' in node._attributes: - if not hasattr(node, 'lineno'): - node.lineno = lineno - else: - lineno = node.lineno - if 'col_offset' in node._attributes: - if not hasattr(node, 'col_offset'): - node.col_offset = col_offset - else: - col_offset = node.col_offset - for child in iter_child_nodes(node): - _fix(child, lineno, col_offset) - _fix(node, 1, 0) - return node - - -def increment_lineno(node, n=1): - """ - Increment the line number of each node in the tree starting at *node* by *n*. - This is useful to "move code" to a different location in a file. - """ - if 'lineno' in node._attributes: - node.lineno = getattr(node, 'lineno', 0) + n - for child in walk(node): - if 'lineno' in child._attributes: - child.lineno = getattr(child, 'lineno', 0) + n - return node - - -def iter_fields(node): - """ - Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` - that is present on *node*. - """ - for field in node._fields: - try: - yield field, getattr(node, field) - except AttributeError: - pass - - -def iter_child_nodes(node): - """ - Yield all direct child nodes of *node*, that is, all fields that are nodes - and all items of fields that are lists of nodes. - """ - for name, field in iter_fields(node): - if isinstance(field, AST): - yield field - elif isinstance(field, list): - for item in field: - if isinstance(item, AST): - yield item - - -def get_docstring(node, clean=True): - """ - Return the docstring for the given node or None if no docstring can - be found. If the node provided does not have docstrings a TypeError - will be raised. - """ - if not isinstance(node, (FunctionDef, ClassDef, Module)): - raise TypeError("%r can't have docstrings" % node.__class__.__name__) - if node.body and isinstance(node.body[0], Expr) and \ - isinstance(node.body[0].value, Str): - if clean: - import inspect - return inspect.cleandoc(node.body[0].value.s) - return node.body[0].value.s - - -def walk(node): - """ - Recursively yield all child nodes of *node*, in no specified order. This is - useful if you only want to modify nodes in place and don't care about the - context. - """ - from collections import deque - todo = deque([node]) - while todo: - node = todo.popleft() - todo.extend(iter_child_nodes(node)) - yield node - - -class NodeVisitor(object): - """ - A node visitor base class that walks the abstract syntax tree and calls a - visitor function for every node found. This function may return a value - which is forwarded by the `visit` method. - - This class is meant to be subclassed, with the subclass adding visitor - methods. - - Per default the visitor functions for the nodes are ``'visit_'`` + - class name of the node. So a `TryFinally` node visit function would - be `visit_TryFinally`. This behavior can be changed by overriding - the `visit` method. If no visitor function exists for a node - (return value `None`) the `generic_visit` visitor is used instead. - - Don't use the `NodeVisitor` if you want to apply changes to nodes during - traversing. For this a special visitor exists (`NodeTransformer`) that - allows modifications. - """ - - def visit(self, node): - """Visit a node.""" - method = 'visit_' + node.__class__.__name__ - visitor = getattr(self, method, self.generic_visit) - return visitor(node) - - def generic_visit(self, node): - """Called if no explicit visitor function exists for a node.""" - for field, value in iter_fields(node): - if isinstance(value, list): - for item in value: - if isinstance(item, AST): - self.visit(item) - elif isinstance(value, AST): - self.visit(value) - - -class NodeTransformer(NodeVisitor): - """ - A :class:`NodeVisitor` subclass that walks the abstract syntax tree and - allows modification of nodes. - - The `NodeTransformer` will walk the AST and use the return value of the - visitor methods to replace or remove the old node. If the return value of - the visitor method is ``None``, the node will be removed from its location, - otherwise it is replaced with the return value. The return value may be the - original node in which case no replacement takes place. - - Here is an example transformer that rewrites all occurrences of name lookups - (``foo``) to ``data['foo']``:: - - class RewriteName(NodeTransformer): - - def visit_Name(self, node): - return copy_location(Subscript( - value=Name(id='data', ctx=Load()), - slice=Index(value=Str(s=node.id)), - ctx=node.ctx - ), node) - - Keep in mind that if the node you're operating on has child nodes you must - either transform the child nodes yourself or call the :meth:`generic_visit` - method for the node first. - - For nodes that were part of a collection of statements (that applies to all - statement nodes), the visitor may also return a list of nodes rather than - just a single node. - - Usually you use the transformer like this:: - - node = YourTransformer().visit(node) - """ - - def generic_visit(self, node): - for field, old_value in iter_fields(node): - old_value = getattr(node, field, None) - if isinstance(old_value, list): - new_values = [] - for value in old_value: - if isinstance(value, AST): - value = self.visit(value) - if value is None: - continue - elif not isinstance(value, AST): - new_values.extend(value) - continue - new_values.append(value) - old_value[:] = new_values - elif isinstance(old_value, AST): - new_node = self.visit(old_value) - if new_node is None: - delattr(node, field) - else: - setattr(node, field, new_node) - return node This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-20 06:07:23
|
Revision: 7250 http://jython.svn.sourceforge.net/jython/?rev=7250&view=rev Author: pjenvey Date: 2011-03-20 06:07:17 +0000 (Sun, 20 Mar 2011) Log Message: ----------- hg version support Modified Paths: -------------- trunk/jython/build.xml trunk/jython/src/org/python/Version.java trunk/jython/src/org/python/core/PySystemState.java Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2011-03-19 23:41:41 UTC (rev 7249) +++ trunk/jython/build.xml 2011-03-20 06:07:17 UTC (rev 7250) @@ -398,10 +398,33 @@ <exec executable="svnversion" failifexecutionfails="false" outputproperty="build.svn.revision"/> </target> + <!-- XXX: Might this work on Windows? --> + <target name="hg-branch" if="os.family.unix"> + <exec executable="hg" failifexecutionfails="false" outputproperty="build.hg.branch"> + <arg line="id -b"/> + </exec> + </target> + <target name="hg-tag" if="os.family.unix"> + <exec executable="hg" failifexecutionfails="false" outputproperty="build.hg.tag"> + <arg line="id -t"/> + </exec> + </target> + <target name="hg-version" if="os.family.unix"> + <exec executable="hg" failifexecutionfails="false" outputproperty="build.hg.version"> + <arg line="id -i"/> + </exec> + </target> + <target name="hg-id" depends="hg-branch, hg-tag, hg-version"/> + <!-- skip-brand can be set in ant.properties or as a system property to keep from updating the version.properties file and making the jar on every developer build. --> + <!-- when hg: + <target name="brand-version" depends="init, hg-id" unless="skip-brand">--> <target name="brand-version" depends="init, svnversion" unless="skip-brand"> <property name="build.svn.revision" value=""/> + <property name="build.hg.branch" value=""/> + <property name="build.hg.tag" value=""/> + <property name="build.hg.version" value=""/> <tstamp> <format property="build.date" pattern="MMM d yyyy" offset="0"/> <format property="build.time" pattern="HH:mm:ss" offset="0"/> @@ -416,7 +439,10 @@ jython.release_serial=${jython.release_serial} jython.build.date=${build.date} jython.build.time=${build.time} -jython.build.svn_revision=${build.svn.revision}</echo> +jython.build.svn_revision=${build.svn.revision} +jython.build.hg_branch=${build.hg.branch} +jython.build.hg_tag=${build.hg.tag} +jython.build.hg_version=${build.hg.version}</echo> </target> <target name="brand-readme-version" depends="checkout" if="do.snapshot.build"> Modified: trunk/jython/src/org/python/Version.java =================================================================== --- trunk/jython/src/org/python/Version.java 2011-03-19 23:41:41 UTC (rev 7249) +++ trunk/jython/src/org/python/Version.java 2011-03-20 06:07:17 UTC (rev 7250) @@ -34,6 +34,8 @@ public static String DATE; public static String TIME; public static String SVN_REVISION; + /** Current hg global revision id (hg id -i). */ + public static String HG_VERSION; /** Determined from headURL, branch is the path under the * subversion root, e.g. branches/asm. */ @@ -42,6 +44,12 @@ /** Short version of branch, e.g. asm. */ public static String SHORT_BRANCH; + /** Current hg branch (hg id -b). */ + public static String HG_BRANCH; + + /** Current hg tag (hg id -t), e.g. 'tip'. */ + public static String HG_TAG; + /** The flags that are set by default in a code object. */ private static final Collection<CodeFlag> defaultCodeFlags = Arrays.asList( CodeFlag.CO_NESTED, CodeFlag.CO_GENERATOR_ALLOWED, CodeFlag.CO_FUTURE_WITH_STATEMENT); @@ -103,6 +111,9 @@ DATE = properties.getProperty("jython.build.date"); TIME = properties.getProperty("jython.build.time"); SVN_REVISION = properties.getProperty("jython.build.svn_revision"); + HG_BRANCH = properties.getProperty("jython.build.hg_branch"); + HG_TAG = properties.getProperty("jython.build.hg_tag"); + HG_VERSION = properties.getProperty("jython.build.hg_version"); } catch (IOException ioe) { System.err.println("There was a problem loading ".concat(versionProperties) .concat(":")); @@ -137,6 +148,21 @@ } /** + * Return the current hg version number. May be an empty string on environments that + * can't determine it. + */ + public static String getHGVersion() { + return HG_VERSION; + } + + /** + * Return the current hg identifier name, either the current branch or tag. + */ + public static String getHGIdentifier() { + return "".equals(HG_TAG) || "tip".equals(HG_TAG) ? HG_BRANCH : HG_TAG; + } + + /** * Return the current build information, including revision and * timestamp. */ @@ -148,6 +174,16 @@ } /** + * Return the current build information, including revision and timestamp. + */ + public static String getBuildInfoHG() { + String revision = getHGVersion(); + String sep = "".equals(revision) ? "" : ":"; + String hgId = getHGIdentifier(); + return String.format("%s%s%s, %.20s, %.9s", hgId, sep, revision, DATE, TIME); + } + + /** * Describe the current Java VM. */ public static String getVM() { Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2011-03-19 23:41:41 UTC (rev 7249) +++ trunk/jython/src/org/python/core/PySystemState.java 2011-03-20 06:07:17 UTC (rev 7250) @@ -75,6 +75,8 @@ public final static Class flags = Options.class; public static PyTuple subversion; + + public static PyTuple _mercurial; /** * The copyright notice for this release. */ @@ -956,6 +958,8 @@ Py.newInteger(Version.PY_RELEASE_SERIAL)); subversion = new PyTuple(Py.newString("Jython"), Py.newString(Version.BRANCH), Py.newString(Version.SVN_REVISION)); + _mercurial = new PyTuple(Py.newString("Jython"), Py.newString(Version.getHGIdentifier()), + Py.newString(Version.getHGVersion())); } public static boolean isPackageCacheEnabled() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-20 19:56:10
|
Revision: 7253 http://jython.svn.sourceforge.net/jython/?rev=7253&view=rev Author: pjenvey Date: 2011-03-20 19:56:03 +0000 (Sun, 20 Mar 2011) Log Message: ----------- o 2.6 core exception related changes o fix exceptions.getString allowing unicode Modified Paths: -------------- trunk/jython/Lib/test/junit_xml.py trunk/jython/src/org/python/core/PyBaseException.java trunk/jython/src/org/python/core/PyException.java trunk/jython/src/org/python/core/exceptions.java Modified: trunk/jython/Lib/test/junit_xml.py =================================================================== --- trunk/jython/Lib/test/junit_xml.py 2011-03-20 19:43:03 UTC (rev 7252) +++ trunk/jython/Lib/test/junit_xml.py 2011-03-20 19:56:03 UTC (rev 7253) @@ -248,8 +248,8 @@ exc = exc_info[1] if exc is None: return safe_str(exc_info[0]) - if isinstance(exc, BaseException) and isinstance(exc.message, unicode): - return safe_str(exc.message) + if isinstance(exc, BaseException) and isinstance(exc.args[0], unicode): + return safe_str(exc.args[0]) try: return safe_str(str(exc)) except UnicodeEncodeError: Modified: trunk/jython/src/org/python/core/PyBaseException.java =================================================================== --- trunk/jython/src/org/python/core/PyBaseException.java 2011-03-20 19:43:03 UTC (rev 7252) +++ trunk/jython/src/org/python/core/PyBaseException.java 2011-03-20 19:56:03 UTC (rev 7253) @@ -18,9 +18,7 @@ public static final PyType TYPE = PyType.fromClass(PyBaseException.class); /** Exception message. */ - @ExposedGet(doc = BuiltinDocs.BaseException_message_doc) - @ExposedSet - public PyObject message = Py.EmptyString; + private PyObject message = Py.EmptyString; /** Exception's arguments. */ @ExposedGet(doc = BuiltinDocs.BaseException_args_doc) @@ -52,25 +50,32 @@ } } + @Override public PyObject __getitem__(PyObject index) { return BaseException___getitem__(index); } @ExposedMethod(doc = BuiltinDocs.BaseException___getitem___doc) final PyObject BaseException___getitem__(PyObject index) { + Py.warnPy3k("__getitem__ not supported for exception classes in 3.x; use args " + + "attribute"); return args.__getitem__(index); } + @Override public PyObject __getslice__(PyObject start, PyObject stop) { return BaseException___getslice__(start, stop); } @ExposedMethod(doc = BuiltinDocs.BaseException___getslice___doc) final PyObject BaseException___getslice__(PyObject start, PyObject stop) { + Py.warnPy3k("__getslice__ not supported for exception classes in 3.x; use args " + + "attribute"); return args.__getslice__(start, stop); } + @Override public PyObject __reduce__() { return BaseException___reduce__(); } @@ -101,6 +106,7 @@ return Py.None; } + @Override public PyObject __findattr_ex__(String name) { return BaseException___findattr__(name); } @@ -116,6 +122,7 @@ return super.__findattr_ex__(name); } + @Override public void __setattr__(String name, PyObject value) { BaseException___setattr__(name, value); } @@ -126,16 +133,19 @@ super.__setattr__(name, value); } + @Override public PyObject fastGetDict() { return __dict__; } + @Override @ExposedGet(name = "__dict__", doc = BuiltinDocs.BaseException___dict___doc) public PyObject getDict() { ensureDict(); return __dict__; } + @Override @ExposedSet(name = "__dict__") public void setDict(PyObject val) { if (!(val instanceof PyStringMap) && !(val instanceof PyDictionary)) { @@ -145,12 +155,14 @@ } private void ensureDict() { + // XXX: __dict__ should really be volatile if (__dict__ == null) { __dict__ = new PyStringMap(); } } - public PyString __str__() { + @Override + public PyString __str__() { return BaseException___str__(); } @@ -167,6 +179,35 @@ } @Override + public PyUnicode __unicode__() { + return BaseException___unicode__(); + } + + @ExposedMethod(doc = BuiltinDocs.BaseException___unicode___doc) + final PyUnicode BaseException___unicode__() { + // CPython issue6108: if __str__ has been overridden in the subclass, unicode() + // should return the message returned by __str__ as used to happen before this + // method was implemented + PyType type = getType(); + PyObject[] where = new PyObject[1]; + PyObject str = type.lookup_where("__str__", where); + if (str != null && where[0] != TYPE) { + // Unlike str(), __str__ can return unicode (i.e. return the equivalent + // of unicode(e.__str__()) instead of unicode(str(e))) + return str.__get__(this, type).__call__().__unicode__(); + } + + switch (args.__len__()) { + case 0: + return new PyUnicode(""); + case 1: + return args.__getitem__(0).__unicode__(); + default: + return args.__unicode__(); + } + } + + @Override public String toString() { return BaseException_toString(); } @@ -187,8 +228,33 @@ args = PyTuple.fromIterable(val); } + @ExposedGet(name = "message", doc = BuiltinDocs.BaseException_message_doc) + public PyObject getMessage() { + PyObject message; + + // if "message" is in self->dict, accessing a user-set message attribute + if (__dict__ != null && (message = __dict__.__finditem__("message")) != null) { + return message; + } + + if (this.message == null) { + throw Py.AttributeError("message attribute was deleted"); + } + + Py.DeprecationWarning("BaseException.message has been deprecated as of Python 2.6"); + return this.message; + } + + @ExposedSet(name = "message") + public void setMessage(PyObject value) { + getDict().__setitem__("message", value); + } + @ExposedDelete(name = "message") public void delMessage() { - message = Py.None; + if (__dict__ != null && (message = __dict__.__finditem__("message")) != null) { + __dict__.__delitem__("message"); + message = null; + } } } Modified: trunk/jython/src/org/python/core/PyException.java =================================================================== --- trunk/jython/src/org/python/core/PyException.java 2011-03-20 19:43:03 UTC (rev 7252) +++ trunk/jython/src/org/python/core/PyException.java 2011-03-20 19:56:03 UTC (rev 7253) @@ -194,9 +194,7 @@ type = type.__getitem__(0); } - if (type.getType() == PyString.TYPE) { - Py.warning(Py.DeprecationWarning, "raising a string exception is deprecated"); - } else if (isExceptionClass(type)) { + if (isExceptionClass(type)) { PyException pye = new PyException(type, value, (PyTraceback)traceback); pye.normalize(); return pye; @@ -212,10 +210,14 @@ } else { // Not something you can raise. You get an exception // anyway, just not what you specified :-) - throw Py.TypeError("exceptions must be classes, instances, or strings (deprecated), " - + "not " + type.getType().fastGetName()); + throw Py.TypeError("exceptions must be old-style classes or derived from " + + "BaseException, not " + type.getType().fastGetName()); } + if (Options.py3kwarning && type instanceof PyClass) { + Py.DeprecationWarning("exceptions must derive from BaseException in 3.x"); + } + return new PyException(type, value, (PyTraceback)traceback); } @@ -255,7 +257,13 @@ } if (isExceptionClass(type) && isExceptionClass(exc)) { - return Py.isSubClass(type, exc); + try { + return Py.isSubClass(type, exc); + } catch (PyException pye) { + // This function must not fail, so print the error here + Py.writeUnraisable(pye, type); + return false; + } } return type == exc; Modified: trunk/jython/src/org/python/core/exceptions.java =================================================================== --- trunk/jython/src/org/python/core/exceptions.java 2011-03-20 19:43:03 UTC (rev 7252) +++ trunk/jython/src/org/python/core/exceptions.java 2011-03-20 19:56:03 UTC (rev 7253) @@ -133,10 +133,12 @@ buildClass(dict, "MemoryError", "StandardError", "Out of memory."); + buildClass(dict, "BufferError", "StandardError", "Buffer error."); + buildClass(dict, "StopIteration", "Exception", "Signal the end from iterator.next()."); - buildClass(dict, "GeneratorExit", "Exception", "Request that a generator exit."); + buildClass(dict, "GeneratorExit", "BaseException", "Request that a generator exit."); buildClass(dict, "Warning", "Exception", "Base class for warning categories."); @@ -166,10 +168,10 @@ buildClass(dict, "UnicodeWarning", "Warning", "Base class for warnings about Unicode related problems, mostly\n" + "related to conversion problems."); - + buildClass(dict, "BytesWarning", "Warning", "Base class for warnings about bytes and buffer related problems, mostly\n" - + "related to conversion from str or comparing to str."); + + "related to conversion from str or comparing to str."); // Initialize ZipImportError here, where it's safe to; it's // needed immediately @@ -373,14 +375,16 @@ public static PyString UnicodeDecodeError__str__(PyObject self, PyObject[] args, String[] kwargs) { - int start = getStart(self, false); - int end = getEnd(self, false); - PyObject encoding = self.__getattr__("encoding"); - PyObject reason = self.__getattr__("reason"); + int start = self.__getattr__("start").asInt(); + int end = self.__getattr__("end").asInt(); + // Get reason and encoding as strings, which they might not be if they've been + // modified after we were contructed + PyObject reason = self.__getattr__("reason").__str__(); + PyObject encoding = self.__getattr__("encoding").__str__(); + PyObject object = getString(self.__getattr__("object"), "object"); String result; - if (end == (start + 1)) { - PyObject object = self.__getattr__("object"); + if (start < object.__len__() && end == (start + 1)) { int badByte = (object.toString().charAt(start)) & 0xff; result = String.format("'%.400s' codec can't decode byte 0x%x in position %d: %.400s", encoding, badByte, start, reason); @@ -406,14 +410,16 @@ public static PyString UnicodeEncodeError__str__(PyObject self, PyObject[] args, String[] kwargs) { - int start = getStart(self, true); - int end = getEnd(self, true); - PyObject encoding = self.__getattr__("encoding"); - PyObject reason = self.__getattr__("reason"); + int start = self.__getattr__("start").asInt(); + int end = self.__getattr__("end").asInt(); + // Get reason and encoding as strings, which they might not be if they've been + // modified after we were contructed + PyObject reason = self.__getattr__("reason").__str__(); + PyObject encoding = self.__getattr__("encoding").__str__(); + PyObject object = getUnicode(self.__getattr__("object"), "object"); String result; - if (end == (start + 1)) { - PyObject object = self.__getattr__("object"); + if (start < object.__len__() && end == (start + 1)) { int badchar = object.toString().codePointAt(start); String badcharStr; if (badchar <= 0xff) { @@ -455,13 +461,16 @@ public static PyString UnicodeTranslateError__str__(PyObject self, PyObject[] args, String[] kwargs) { - int start = getStart(self, true); - int end = getEnd(self, true); - PyObject reason = self.__getattr__("reason"); + int start = self.__getattr__("start").asInt(); + int end = self.__getattr__("end").asInt(); + // Get reason as a string, which it might not be if it's been modified after we + // were contructed + PyObject reason = self.__getattr__("reason").__str__(); + PyObject object = getUnicode(self.__getattr__("object"), "object"); String result; - if (end == (start + 1)) { - int badchar = (self.__getattr__("object").toString().codePointAt(start)); + if (start < object.__len__() && end == (start + 1)) { + int badchar = object.toString().codePointAt(start); String badCharStr; if (badchar <= 0xff) { badCharStr = String.format("x%02x", badchar); @@ -488,7 +497,7 @@ * @return an the start position */ public static int getStart(PyObject self, boolean unicode) { - int start = getInt(self.__getattr__("start"), "start"); + int start = self.__getattr__("start").asInt(); PyObject object; if (unicode) { object = getUnicode(self.__getattr__("object"), "object"); @@ -513,7 +522,7 @@ * @return an the end position */ public static int getEnd(PyObject self, boolean unicode) { - int end = getInt(self.__getattr__("end"), "end"); + int end = self.__getattr__("end").asInt(); PyObject object; if (unicode) { object = getUnicode(self.__getattr__("object"), "object"); @@ -530,22 +539,6 @@ } /** - * Parse an int value for UnicodeErrors - * - * @param attr a PyObject - * @param name of the attribute - * @return an int value - */ - public static int getInt(PyObject attr, String name) { - if (attr instanceof PyInteger) { - return ((PyInteger)attr).asInt(); - } else if (attr instanceof PyLong) { - return ((PyLong)attr).asInt(); - } - throw Py.TypeError(String.format("%.200s attribute must be int", name)); - } - - /** * Ensure a PyString value for UnicodeErrors * * @param attr a PyObject @@ -553,7 +546,7 @@ * @return an PyString */ public static PyString getString(PyObject attr, String name) { - if (!(attr instanceof PyString)) { + if (!Py.isInstance(attr, PyString.TYPE)) { throw Py.TypeError(String.format("%.200s attribute must be str", name)); } return (PyString)attr; @@ -663,10 +656,12 @@ this.javaMethod = javaMethod; } + @Override public PyBuiltinCallable bind(PyObject self) { return new BoundStaticJavaMethod(getType(), self, info, javaMethod); } + @Override public PyObject __get__(PyObject obj, PyObject type) { if (obj != null) { return bind(obj); @@ -674,6 +669,7 @@ return makeDescriptor((PyType)type); } + @Override public PyObject __call__(PyObject[] args, String kwargs[]) { try { return Py.java2py(javaMethod.invoke(null, self, args, kwargs)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-21 05:01:07
|
Revision: 7254 http://jython.svn.sourceforge.net/jython/?rev=7254&view=rev Author: pjenvey Date: 2011-03-21 05:01:00 +0000 (Mon, 21 Mar 2011) Log Message: ----------- more 2.6 exception changes Modified Paths: -------------- trunk/jython/src/org/python/core/Py.java trunk/jython/src/org/python/core/PyException.java Removed Paths: ------------- trunk/jython/Lib/test/exception_hierarchy.txt Deleted: trunk/jython/Lib/test/exception_hierarchy.txt =================================================================== --- trunk/jython/Lib/test/exception_hierarchy.txt 2011-03-20 19:56:03 UTC (rev 7253) +++ trunk/jython/Lib/test/exception_hierarchy.txt 2011-03-21 05:01:00 UTC (rev 7254) @@ -1,49 +0,0 @@ -BaseException - +-- SystemExit - +-- KeyboardInterrupt - +-- GeneratorExit - +-- Exception - +-- StopIteration - +-- StandardError - | +-- ArithmeticError - | | +-- FloatingPointError - | | +-- OverflowError - | | +-- ZeroDivisionError - | +-- AssertionError - | +-- AttributeError - | +-- EnvironmentError - | | +-- IOError - | | +-- OSError - | | +-- WindowsError (Windows) - | | +-- VMSError (VMS) - | +-- EOFError - | +-- ImportError - | +-- LookupError - | | +-- IndexError - | | +-- KeyError - | +-- MemoryError - | +-- NameError - | | +-- UnboundLocalError - | +-- ReferenceError - | +-- RuntimeError - | | +-- NotImplementedError - | +-- SyntaxError - | | +-- IndentationError - | | +-- TabError - | +-- SystemError - | +-- TypeError - | +-- ValueError - | +-- UnicodeError - | +-- UnicodeDecodeError - | +-- UnicodeEncodeError - | +-- UnicodeTranslateError - +-- Warning - +-- DeprecationWarning - +-- PendingDeprecationWarning - +-- RuntimeWarning - +-- SyntaxWarning - +-- UserWarning - +-- FutureWarning - +-- ImportWarning - +-- UnicodeWarning - +-- BytesWarning Modified: trunk/jython/src/org/python/core/Py.java =================================================================== --- trunk/jython/src/org/python/core/Py.java 2011-03-20 19:56:03 UTC (rev 7253) +++ trunk/jython/src/org/python/core/Py.java 2011-03-21 05:01:00 UTC (rev 7254) @@ -353,6 +353,7 @@ public static PyException MemoryError(String message) { return new PyException(Py.MemoryError, message); } + public static PyObject BufferError; public static PyObject ArithmeticError; public static PyObject LookupError; public static PyObject StandardError; @@ -767,6 +768,7 @@ NameError = initExc("NameError", exc, dict); UnboundLocalError = initExc("UnboundLocalError", exc, dict); AttributeError = initExc("AttributeError", exc, dict); + SyntaxError = initExc("SyntaxError", exc, dict); IndentationError = initExc("IndentationError", exc, dict); TabError = initExc("TabError", exc, dict); @@ -787,6 +789,7 @@ ReferenceError = initExc("ReferenceError", exc, dict); SystemError = initExc("SystemError", exc, dict); MemoryError = initExc("MemoryError", exc, dict); + BufferError = initExc("BufferError", exc, dict); Warning = initExc("Warning", exc, dict); UserWarning = initExc("UserWarning", exc, dict); DeprecationWarning = initExc("DeprecationWarning", exc, dict); Modified: trunk/jython/src/org/python/core/PyException.java =================================================================== --- trunk/jython/src/org/python/core/PyException.java 2011-03-20 19:56:03 UTC (rev 7253) +++ trunk/jython/src/org/python/core/PyException.java 2011-03-21 05:01:00 UTC (rev 7254) @@ -237,6 +237,13 @@ return false; } + if (exc instanceof PyString) { + Py.DeprecationWarning("catching of string exceptions is deprecated"); + } else if (Options.py3kwarning && !isPy3kExceptionClass(exc)) { + Py.DeprecationWarning("catching classes that don't inherit from BaseException is not " + + "allowed in 3.x"); + } + normalize(); // FIXME, see bug 737978 // @@ -279,6 +286,16 @@ if (obj instanceof PyClass) { return true; } + return isPy3kExceptionClass(obj); + } + + /** + * Determine whether obj is a Python 3 exception class + * + * @param obj a PyObject + * @return true if an exception + */ + private static boolean isPy3kExceptionClass(PyObject obj) { if (!(obj instanceof PyType)) { return false; } @@ -286,7 +303,8 @@ if (type.isSubType(PyBaseException.TYPE)) { return true; } - return type.getProxyType() != null && Throwable.class.isAssignableFrom(type.getProxyType()); + return type.getProxyType() != null + && Throwable.class.isAssignableFrom(type.getProxyType()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-21 05:57:46
|
Revision: 7257 http://jython.svn.sourceforge.net/jython/?rev=7257&view=rev Author: pjenvey Date: 2011-03-21 05:57:39 +0000 (Mon, 21 Mar 2011) Log Message: ----------- a somewhat complete PEP 3101 implementation (str.format) refs #1718 from Dmitry Jemerov @ PyCon 2011 (thanks!) Modified Paths: -------------- trunk/jython/CoreExposed.includes trunk/jython/src/org/python/core/PyInstance.java trunk/jython/src/org/python/core/PyInteger.java trunk/jython/src/org/python/core/PyLong.java trunk/jython/src/org/python/core/PyObject.java trunk/jython/src/org/python/core/PyString.java trunk/jython/src/org/python/core/__builtin__.java Added Paths: ----------- trunk/jython/src/org/python/core/stringlib/ trunk/jython/src/org/python/core/stringlib/FieldNameIterator.java trunk/jython/src/org/python/core/stringlib/InternalFormatSpec.java trunk/jython/src/org/python/core/stringlib/InternalFormatSpecParser.java trunk/jython/src/org/python/core/stringlib/MarkupIterator.java trunk/jython/tests/java/org/python/core/StringFormatTest.java Modified: trunk/jython/CoreExposed.includes =================================================================== --- trunk/jython/CoreExposed.includes 2011-03-21 05:46:52 UTC (rev 7256) +++ trunk/jython/CoreExposed.includes 2011-03-21 05:57:39 UTC (rev 7257) @@ -44,6 +44,8 @@ org/python/core/PyType.class org/python/core/PyUnicode.class org/python/core/PyXRange.class +org/python/core/stringlib/MarkupIterator.class +org/python/core/stringlib/FieldNameIterator.class org/python/modules/PyStruct.class org/python/modules/PyTeeIterator.class org/python/jsr223/PyScriptEngineScope.class Modified: trunk/jython/src/org/python/core/PyInstance.java =================================================================== --- trunk/jython/src/org/python/core/PyInstance.java 2011-03-21 05:46:52 UTC (rev 7256) +++ trunk/jython/src/org/python/core/PyInstance.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -787,6 +787,19 @@ ret.getType().fastGetName())); } + @Override + public PyObject __format__(PyObject format_spec) { + return instance___format__(format_spec); + } + + @ExposedMethod + final PyObject instance___format__(PyObject format_spec) { + PyObject func = __findattr__("__format__"); + if (func == null) + return super.__format__(format_spec); + return func.__call__(format_spec); + } + // Generated by make_binops.py // Unary ops Modified: trunk/jython/src/org/python/core/PyInteger.java =================================================================== --- trunk/jython/src/org/python/core/PyInteger.java 2011-03-21 05:46:52 UTC (rev 7256) +++ trunk/jython/src/org/python/core/PyInteger.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -7,6 +7,8 @@ import java.io.Serializable; import java.math.BigInteger; +import org.python.core.stringlib.InternalFormatSpec; +import org.python.core.stringlib.InternalFormatSpecParser; import org.python.expose.ExposedGet; import org.python.expose.ExposedMethod; import org.python.expose.ExposedNew; @@ -912,6 +914,118 @@ } @Override + public PyObject __format__(PyObject format_spec) { + return int___format__(format_spec); + } + + @ExposedMethod(doc = BuiltinDocs.int___format___doc) + final PyObject int___format__(PyObject format_spec) { + return formatImpl(getValue(), format_spec); + } + + static PyObject formatImpl(Object value, PyObject format_spec) { + if (format_spec instanceof PyString) { + String result; + try { + String specString = ((PyString) format_spec).getString(); + InternalFormatSpec spec = new InternalFormatSpecParser(specString).parse(); + result = formatIntOrLong(value, spec); + } catch (IllegalArgumentException e) { + throw Py.ValueError(e.getMessage()); + } + if (format_spec instanceof PyUnicode) { + return new PyUnicode(result); + } + return new PyString(result); + } + throw Py.TypeError("__format__ requires str or unicode"); + } + + /** + * Formats an integer or long number according to a PEP-3101 format specification. + * + * @param value Integer or BigInteger object specifying the value to format. + * @param spec parsed PEP-3101 format specification. + * @return result of the formatting. + */ + public static String formatIntOrLong(Object value, InternalFormatSpec spec) { + if (spec.precision != -1) { + throw new IllegalArgumentException("Precision not allowed in integer format specifier"); + } + int sign; + if (value instanceof Integer) { + int intValue = (Integer) value; + sign = intValue < 0 ? -1 : intValue == 0 ? 0 : 1; + } + else { + sign = ((BigInteger) value).signum(); + } + String strValue; + if (spec.type == 'c') { + if (spec.sign != '\0') { + throw new IllegalArgumentException("Sign not allowed with " + + "integer format specifier 'c'"); + } + if (value instanceof Integer) { + int intValue = (Integer) value; + if (intValue > 0xffff) { + throw new IllegalArgumentException("%c arg not in range(0x10000)"); + } + strValue = Character.toString((char) intValue); + } + else { + BigInteger bigInt = (BigInteger) value; + if (bigInt.intValue() > 0xffff || bigInt.bitCount() > 16) { + throw new IllegalArgumentException("%c arg not in range(0x10000)"); + } + strValue = Character.toString((char) bigInt.intValue()); + } + } else { + int radix = 10; + if (spec.type == 'o') { + radix = 8; + } else if (spec.type == 'x' || spec.type == 'X') { + radix = 16; + } else if (spec.type == 'b') { + radix = 2; + } + + // TODO locale-specific formatting for 'n' + if (value instanceof BigInteger) { + strValue = ((BigInteger) value).toString(radix); + } + else { + strValue = Integer.toString((Integer) value, radix); + } + + if (spec.alternate) { + if (radix == 2) + strValue = "0b" + strValue; + else if (radix == 8) + strValue = "0o" + strValue; + else if (radix == 16) + strValue = "0x" + strValue; + } + if (spec.type == 'X') { + strValue = strValue.toUpperCase(); + } + + if (sign >= 0) { + if (spec.sign == '+') { + strValue = "+" + strValue; + } else if (spec.sign == ' ') { + strValue = " " + strValue; + } + } + } + if (spec.align == '=' && (sign < 0 || spec.sign == '+' || spec.sign == ' ')) { + char signChar = strValue.charAt(0); + return signChar + spec.pad(strValue.substring(1), '>', 1); + } + return spec.pad(strValue, '>', 0); + } + + @Override public boolean isIndex() { return true; } Modified: trunk/jython/src/org/python/core/PyLong.java =================================================================== --- trunk/jython/src/org/python/core/PyLong.java 2011-03-21 05:46:52 UTC (rev 7256) +++ trunk/jython/src/org/python/core/PyLong.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -982,6 +982,16 @@ } @Override + public PyObject __format__(PyObject format_spec) { + return long___format__(format_spec); + } + + @ExposedMethod(doc = BuiltinDocs.long___format___doc) + final PyObject long___format__(PyObject format_spec) { + return PyInteger.formatImpl(getValue(), format_spec); + } + + @Override public boolean isIndex() { return true; } Modified: trunk/jython/src/org/python/core/PyObject.java =================================================================== --- trunk/jython/src/org/python/core/PyObject.java 2011-03-21 05:46:52 UTC (rev 7256) +++ trunk/jython/src/org/python/core/PyObject.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -1710,6 +1710,16 @@ return false; } + public PyObject __format__(PyObject format_spec) { + return object___format__(format_spec); + } + + @ExposedMethod(doc = BuiltinDocs.object___format___doc) + final PyObject object___format__(PyObject format_spec) { + PyString str = __str__(); + return str.__format__(format_spec); + } + /** * Implements boolean not * Modified: trunk/jython/src/org/python/core/PyString.java =================================================================== --- trunk/jython/src/org/python/core/PyString.java 2011-03-21 05:46:52 UTC (rev 7256) +++ trunk/jython/src/org/python/core/PyString.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -3,6 +3,10 @@ import java.math.BigInteger; +import org.python.core.stringlib.FieldNameIterator; +import org.python.core.stringlib.InternalFormatSpec; +import org.python.core.stringlib.InternalFormatSpecParser; +import org.python.core.stringlib.MarkupIterator; import org.python.core.util.ExtraMath; import org.python.core.util.StringUtil; import org.python.expose.ExposedMethod; @@ -2510,6 +2514,155 @@ return codecs.decode(this, encoding, errors); } + @ExposedMethod(doc = BuiltinDocs.str__formatter_parser_doc) + final PyObject str__formatter_parser() { + return new MarkupIterator(getString()); + } + + @ExposedMethod(doc = BuiltinDocs.str__formatter_field_name_split_doc) + final PyObject str__formatter_field_name_split() { + FieldNameIterator iterator = new FieldNameIterator(getString()); + Object headObj = iterator.head(); + PyObject head = headObj instanceof Integer + ? new PyInteger((Integer) headObj) + : new PyString((String) headObj); + return new PyTuple(head, iterator); + } + + @ExposedMethod(doc = BuiltinDocs.str_format_doc) + final PyObject str_format(PyObject[] args, String[] keywords) { + try { + return new PyString(buildFormattedString(getString(), args, keywords)); + } catch(IllegalArgumentException e) { + throw Py.ValueError(e.getMessage()); + } + } + + private String buildFormattedString(String value, PyObject[] args, String[] keywords) { + StringBuilder result = new StringBuilder(); + MarkupIterator it = new MarkupIterator(value); + while (true) { + MarkupIterator.Chunk chunk = it.nextChunk(); + if (chunk == null) { + break; + } + result.append(chunk.literalText); + if (chunk.fieldName.length() > 0) { + outputMarkup(result, chunk, args, keywords); + } + } + return result.toString(); + } + + private void outputMarkup(StringBuilder result, MarkupIterator.Chunk chunk, + PyObject[] args, String[] keywords) { + PyObject fieldObj = getFieldObject(chunk.fieldName, args, keywords); + if (fieldObj == null) { + return; + } + if ("r".equals(chunk.conversion)) { + fieldObj = fieldObj.__repr__(); + } + else if ("s".equals(chunk.conversion)) { + fieldObj = fieldObj.__str__(); + } + else if (chunk.conversion != null) { + throw Py.ValueError("Unknown conversion specifier " + chunk.conversion); + } + String formatSpec = chunk.formatSpec; + if (chunk.formatSpecNeedsExpanding) { + formatSpec = buildFormattedString(formatSpec, args, keywords); + } + renderField(fieldObj, formatSpec, result); + } + + private PyObject getFieldObject(String fieldName, PyObject[] args, String[] keywords) { + FieldNameIterator iterator = new FieldNameIterator(fieldName); + Object head = iterator.head(); + PyObject obj = null; + int positionalCount = args.length - keywords.length; + if (head instanceof Integer) { + int index = (Integer) head; + if (index >= positionalCount) { + throw Py.IndexError("tuple index out of range"); + } + obj = args[index]; + } + else { + for (int i = 0; i < keywords.length; i++) { + if (keywords[i].equals(head)) { + obj = args[positionalCount+i]; + break; + } + } + if (obj == null) { + throw Py.KeyError((String) head); + } + } + if (obj != null) { + while (true) { + FieldNameIterator.Chunk chunk = iterator.nextChunk(); + if (chunk == null) { + break; + } + if (chunk.is_attr) { + obj = obj.__getattr__((String) chunk.value); + } + else { + PyObject key = chunk.value instanceof String + ? new PyString((String) chunk.value) + : new PyInteger((Integer) chunk.value); + obj = obj.__getitem__(key); + } + if (obj == null) break; + } + } + return obj; + } + + private void renderField(PyObject fieldObj, String formatSpec, StringBuilder result) { + PyString formatSpecStr = formatSpec == null ? Py.EmptyString : new PyString(formatSpec); + result.append(fieldObj.__format__(formatSpecStr).asString()); + } + + @Override + public PyObject __format__(PyObject format_spec) { + return str___format__(format_spec); + } + + @ExposedMethod(doc = BuiltinDocs.str___format___doc) + final PyObject str___format__(PyObject format_spec) { + if (format_spec instanceof PyString) { + String result; + try { + String specString = ((PyString) format_spec).getString(); + InternalFormatSpec spec = new InternalFormatSpecParser(specString).parse(); + result = formatString(getString(), spec); + } catch (IllegalArgumentException e) { + throw Py.ValueError(e.getMessage()); + } + if (format_spec instanceof PyUnicode) { + return new PyUnicode(result); + } + return new PyString(result); + } + throw Py.TypeError("__format__ requires str or unicode"); + } + + /** + * Internal implementation of str.__format__() + * + * @param text the text to format + * @param spec the PEP 3101 formatting specification + * @return the result of the formatting + */ + public static String formatString(String text, InternalFormatSpec spec) { + if (spec.precision >= 0 && text.length() > spec.precision) { + text = text.substring(0, spec.precision); + } + return spec.pad(text, '<', 0); + } + /* arguments' conversion helper */ @Override Modified: trunk/jython/src/org/python/core/__builtin__.java =================================================================== --- trunk/jython/src/org/python/core/__builtin__.java 2011-03-21 05:46:52 UTC (rev 7256) +++ trunk/jython/src/org/python/core/__builtin__.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -358,6 +358,7 @@ dict.__setitem__("sorted", new SortedFunction()); dict.__setitem__("all", new AllFunction()); dict.__setitem__("any", new AnyFunction()); + dict.__setitem__("format", new FormatFunction()); } public static PyObject abs(PyObject o) { @@ -1303,6 +1304,25 @@ } } +class FormatFunction extends PyBuiltinFunctionNarrow { + FormatFunction() { + super("format", 1, 2, + "format(value[, format_spec]) -> string\n\n" + + "Returns value.__format__(format_spec)\n" + + "format_spec defaults to \"\""); + } + + @Override + public PyObject __call__(PyObject arg1) { + return __call__(arg1, new PyString("")); + } + + @Override + public PyObject __call__(PyObject arg1, PyObject arg2) { + return arg1.__format__(arg2); + } +} + class MaxFunction extends PyBuiltinFunction { MaxFunction() { super("max", Added: trunk/jython/src/org/python/core/stringlib/FieldNameIterator.java =================================================================== --- trunk/jython/src/org/python/core/stringlib/FieldNameIterator.java (rev 0) +++ trunk/jython/src/org/python/core/stringlib/FieldNameIterator.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -0,0 +1,117 @@ +package org.python.core.stringlib; + +import org.python.core.*; +import org.python.expose.ExposedMethod; +import org.python.expose.ExposedType; + +/** + * Provides an implementation of str._formatter_field_name_split() + */ +@ExposedType(name = "fieldnameiterator", base = PyObject.class, isBaseType = false) +public class FieldNameIterator extends PyObject { + private String markup; + private Object head; + private int index; + + public FieldNameIterator(String markup) { + this.markup = markup; + this.index = nextDotOrBracket(markup); + String headStr = markup.substring(0, index); + try { + this.head = Integer.parseInt(headStr); + } catch (NumberFormatException e) { + this.head = headStr; + } + } + + @Override + public PyObject __iter__() { + return this; + } + + @ExposedMethod + public PyObject fieldnameiterator___iter__() { + return this; + } + + public PyObject __iternext__() { + Chunk chunk = nextChunk(); + if (chunk == null) { + return null; + } + PyObject[] elements = new PyObject[2]; + elements [0] = new PyBoolean(chunk.is_attr); + if (chunk.value instanceof Integer) { + elements [1] = new PyInteger((Integer) chunk.value); + } + else { + elements [1] = new PyString((String) chunk.value); + } + return new PyTuple(elements); + } + + @ExposedMethod + public PyObject fieldnameiterator___iternext__() { + return __iternext__(); + } + + private int nextDotOrBracket(String markup) { + int dotPos = markup.indexOf('.', index); + if (dotPos < 0) dotPos = markup.length(); + int bracketPos = markup.indexOf('[', index); + if (bracketPos < 0) bracketPos = markup.length(); + return Math.min(dotPos, bracketPos); + } + + public Object head() { + return head; + } + + public Chunk nextChunk() { + if (index == markup.length()) { + return null; + } + Chunk chunk = new Chunk(); + if (markup.charAt(index) == '[') { + parseItemChunk(chunk); + } + else if (markup.charAt(index) == '.') { + parseAttrChunk(chunk); + } + return chunk; + } + + private void parseItemChunk(Chunk chunk) { + chunk.is_attr = false; + int endBracket = markup.indexOf(']', index+1); + if (endBracket < 0) { + throw new IllegalArgumentException("Missing ']' in format string"); + } + String itemValue = markup.substring(index+1, endBracket); + if (itemValue.length() == 0) { + throw new IllegalArgumentException("Empty attribute in format string"); + } + try { + chunk.value = Integer.parseInt(itemValue); + } catch (NumberFormatException e) { + chunk.value = itemValue; + } + index = endBracket+1; + } + + private void parseAttrChunk(Chunk chunk) { + index++; // skip dot + chunk.is_attr = true; + int pos = nextDotOrBracket(markup); + if (pos == index) { + throw new IllegalArgumentException("Empty attribute in format string"); + } + chunk.value = markup.substring(index, pos); + index = pos; + } + + public static class Chunk { + public boolean is_attr; + public Object value; // Integer or String + } +} Added: trunk/jython/src/org/python/core/stringlib/InternalFormatSpec.java =================================================================== --- trunk/jython/src/org/python/core/stringlib/InternalFormatSpec.java (rev 0) +++ trunk/jython/src/org/python/core/stringlib/InternalFormatSpec.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -0,0 +1,42 @@ +package org.python.core.stringlib; + +/** + * Parsed PEP-3101 format specification of a single field. + */ +public final class InternalFormatSpec { + public char fill_char; + public char align; + public boolean alternate; + public char sign; + public int width = -1; + public int precision = -1; + public char type; + + public String pad(String value, char defaultAlign, int leaveWidth) { + int remaining = width - value.length() - leaveWidth; + if (remaining <= 0) { + return value; + } + StringBuilder result = new StringBuilder(); + int leading = remaining; + int useAlign = align; + if (useAlign == 0) { + useAlign = defaultAlign; + } + if (useAlign == '^') { + leading = remaining/2; + } + else if (useAlign == '<') { + leading = 0; + } + char fill = fill_char != 0 ? fill_char : ' '; + for (int i = 0; i < leading; i++) { + result.append(fill); + } + result.append(value); + for (int i = 0; i < remaining-leading; i++) { + result.append(fill); + } + return result.toString(); + } +} Added: trunk/jython/src/org/python/core/stringlib/InternalFormatSpecParser.java =================================================================== --- trunk/jython/src/org/python/core/stringlib/InternalFormatSpecParser.java (rev 0) +++ trunk/jython/src/org/python/core/stringlib/InternalFormatSpecParser.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -0,0 +1,83 @@ +package org.python.core.stringlib; + +/** + * Parser for PEP-3101 field format specifications. + */ +public class InternalFormatSpecParser { + private String spec; + private int index; + + public InternalFormatSpecParser(String spec) { + this.spec = spec; + this.index = 0; + } + + private static boolean isAlign(char c) { + switch(c) { + case '<': + case '>': + case '=': + case '^': + return true; + default: + return false; + } + } + + public InternalFormatSpec parse() { + InternalFormatSpec result = new InternalFormatSpec(); + if (spec.length() >= 1 && isAlign(spec.charAt(0))) { + result.align = spec.charAt(index); + index++; + } + else if (spec.length() >= 2 && isAlign(spec.charAt(1))) { + result.fill_char = spec.charAt(0); + result.align = spec.charAt(1); + index += 2; + } + if (isAt("+- ")) { + result.sign = spec.charAt(index); + index++; + } + if (isAt("#")) { + result.alternate = true; + index++; + } + if (isAt("0")) { + result.align = '='; + result.fill_char = '0'; + index++; + } + result.width = getInteger(); + if (isAt(".")) { + index++; + result.precision = getInteger(); + if (result.precision == -1) { + throw new IllegalArgumentException("Format specifier missing precision"); + } + } + if (index < spec.length()) { + result.type = spec.charAt(index); + if (index + 1 != spec.length()) { + throw new IllegalArgumentException("Invalid conversion specification"); + } + } + return result; + } + + private int getInteger() { + int value = 0; + boolean empty = true; + while (index < spec.length() && spec.charAt(index) >= '0' && spec.charAt(index) <= '9') { + value = value * 10 + spec.charAt(index) - '0'; + index++; + empty = false; + } + if (empty) return -1; + return value; + } + + private boolean isAt(String chars) { + return index < spec.length() && chars.indexOf(spec.charAt(index)) >= 0; + } +} Added: trunk/jython/src/org/python/core/stringlib/MarkupIterator.java =================================================================== --- trunk/jython/src/org/python/core/stringlib/MarkupIterator.java (rev 0) +++ trunk/jython/src/org/python/core/stringlib/MarkupIterator.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -0,0 +1,159 @@ +package org.python.core.stringlib; + +import org.python.core.*; +import org.python.expose.ExposedMethod; +import org.python.expose.ExposedType; + +/** + * Provides an implementation of str._formatter_parser() + */ +@ExposedType(name = "formatteriterator", base = PyObject.class, isBaseType = false) +public class MarkupIterator extends PyObject { + private final String markup; + private int index; + + public MarkupIterator(String markup) { + this.markup = markup; + } + + @Override + public PyObject __iter__() { + return this; + } + + @ExposedMethod + public PyObject formatteriterator___iter__() { + return this; + } + + public PyObject __iternext__() { + Chunk chunk; + try { + chunk = nextChunk(); + } catch (IllegalArgumentException e) { + throw Py.ValueError(e.getMessage()); + } + if (chunk == null) { + return null; + } + PyObject[] elements = new PyObject[4]; + elements[0] = new PyString(chunk.literalText); + elements[1] = new PyString(chunk.fieldName); + if (chunk.fieldName.length() > 0) { + elements[2] = chunk.formatSpec == null ? Py.EmptyString : new PyString(chunk.formatSpec); + } + else { + elements[2] = Py.None; + } + elements[3] = chunk.conversion == null ? Py.None : new PyString(chunk.conversion); + return new PyTuple(elements); + } + + @ExposedMethod + public PyObject formatteriterator___iternext__() { + return __iternext__(); + } + + public Chunk nextChunk() { + if (index == markup.length()) { + return null; + } + Chunk result = new Chunk(); + int pos = index; + while(true) { + pos = indexOfFirst(markup, pos, '{', '}'); + if (pos >= 0 && pos < markup.length()-1 && + markup.charAt(pos+1) == markup.charAt(pos)) { + pos += 2; // skip escaped bracket + } + else if (pos >= 0 && markup.charAt(pos) == '}') { + throw new IllegalArgumentException("Single '}' encountered in format string"); + } + else { + break; + } + } + if (pos < 0) { + result.literalText = unescapeBraces(markup.substring(index)); + result.fieldName = ""; + index = markup.length(); + } + else { + result.literalText = unescapeBraces(markup.substring(index, pos)); + pos++; + int fieldStart = pos; + int count = 1; + while (pos < markup.length()) { + if (markup.charAt(pos) == '{') { + count++; + result.formatSpecNeedsExpanding = true; + } + else if (markup.charAt(pos) == '}') { + count--; + if (count == 0) { + parseField(result, markup.substring(fieldStart, pos)); + pos++; + break; + } + } + pos++; + } + if (count > 0) + throw new IllegalArgumentException("Single '{' encountered in format string"); + index = pos; + } + return result; + } + + private String unescapeBraces(String substring) { + return substring.replace("{{", "{").replace("}}", "}"); + } + + private void parseField(Chunk result, String fieldMarkup) { + int pos = indexOfFirst(fieldMarkup, 0, '!', ':'); + if (pos >= 0) { + result.fieldName = fieldMarkup.substring(0, pos); + if (fieldMarkup.charAt(pos) == '!') { + if (pos == fieldMarkup.length() - 1) { + throw new IllegalArgumentException("end of format while " + + "looking for conversion specifier"); + } + result.conversion = fieldMarkup.substring(pos + 1, pos + 2); + pos += 2; + if (pos < fieldMarkup.length()) { + if (fieldMarkup.charAt(pos) != ':') { + throw new IllegalArgumentException("expected ':' " + + "after conversion specifier"); + } + result.formatSpec = fieldMarkup.substring(pos+1); + } + } + else { + result.formatSpec = fieldMarkup.substring(pos+1); + } + } + else { + result.fieldName = fieldMarkup; + } + } + + private int indexOfFirst(String s, int start, char c1, char c2) { + int i1 = s.indexOf(c1, start); + int i2 = s.indexOf(c2, start); + if (i1 == -1) { + return i2; + } + if (i2 == -1) { + return i1; + } + return Math.min(i1, i2); + } + + public static final class Chunk { + public String literalText; + public String fieldName; + public String formatSpec; + public String conversion; + public boolean formatSpecNeedsExpanding; + } +} Added: trunk/jython/tests/java/org/python/core/StringFormatTest.java =================================================================== --- trunk/jython/tests/java/org/python/core/StringFormatTest.java (rev 0) +++ trunk/jython/tests/java/org/python/core/StringFormatTest.java 2011-03-21 05:57:39 UTC (rev 7257) @@ -0,0 +1,216 @@ +package org.python.core; + +import junit.framework.TestCase; +import org.python.core.stringlib.FieldNameIterator; +import org.python.core.stringlib.InternalFormatSpec; +import org.python.core.stringlib.InternalFormatSpecParser; +import org.python.core.stringlib.MarkupIterator; + +/** + * Tests for internal bits and pieces of string.format implementation. + */ +public class StringFormatTest extends TestCase { + public void testInternalFormatSpec() { + InternalFormatSpec spec = new InternalFormatSpecParser("x").parse(); + assertEquals('x', spec.type); + + spec = new InternalFormatSpecParser("<x").parse(); + assertEquals('<', spec.align); + assertEquals('x', spec.type); + + spec = new InternalFormatSpecParser("~<x").parse(); + assertEquals('~', spec.fill_char); + assertEquals('<', spec.align); + assertEquals('x', spec.type); + + spec = new InternalFormatSpecParser("+x").parse(); + assertEquals('+', spec.sign); + assertEquals('x', spec.type); + + spec = new InternalFormatSpecParser("#x").parse(); + assertEquals(true, spec.alternate); + + spec = new InternalFormatSpecParser("0x").parse(); + assertEquals('=', spec.align); + assertEquals('0', spec.fill_char); + + spec = new InternalFormatSpecParser("123x").parse(); + assertEquals(123, spec.width); + + spec = new InternalFormatSpecParser("123.456x").parse(); + assertEquals(123, spec.width); + assertEquals(456, spec.precision); + + assertParseError("123.x", "Format specifier missing precision"); + + assertParseError("123xx", "Invalid conversion specification"); + + spec = new InternalFormatSpecParser("").parse(); + assertEquals(0, spec.type); + } + + private void assertParseError(String spec, String expected) { + String error = null; + try { + new InternalFormatSpecParser(spec).parse(); + } catch (IllegalArgumentException e) { + error = e.getMessage(); + } + assertEquals(expected, error); + } + + public void testFormatIntOrLong() { + InternalFormatSpec spec = new InternalFormatSpec(); + spec.type = 'd'; + assertEquals("123", PyInteger.formatIntOrLong(123, spec)); + spec.type = 'o'; + assertEquals("173", PyInteger.formatIntOrLong(123, spec)); + spec.type = 'x'; + assertEquals("7b", PyInteger.formatIntOrLong(123, spec)); + spec.type = 'X'; + assertEquals("7B", PyInteger.formatIntOrLong(123, spec)); + spec.type = 'b'; + assertEquals("1111011", PyInteger.formatIntOrLong(123, spec)); + + spec.alternate = true; + spec.type = 'o'; + assertEquals("0o173", PyInteger.formatIntOrLong(123, spec)); + spec.type = 'X'; + assertEquals("0X7B", PyInteger.formatIntOrLong(123, spec)); + spec.alternate = false; + + spec.type = 'c'; + assertEquals("{", PyInteger.formatIntOrLong(123, spec)); + + spec.type = 'd'; + spec.sign = '+'; + assertEquals("+123", PyInteger.formatIntOrLong(123, spec)); + spec.sign = ' '; + assertEquals(" 123", PyInteger.formatIntOrLong(123, spec)); + + spec.sign = 0; + spec.width = 5; + assertEquals(" 123", PyInteger.formatIntOrLong(123, spec)); + + spec.align = '^'; + spec.width = 6; + assertEquals(" 123 ", PyInteger.formatIntOrLong(123, spec)); + + spec.align = '<'; + spec.width = 5; + spec.fill_char = '~'; + assertEquals("123~~", PyInteger.formatIntOrLong(123, spec)); + + spec.align = '='; + spec.width = 6; + spec.fill_char = '0'; + spec.sign = '+'; + assertEquals("+00123", PyInteger.formatIntOrLong(123, spec)); + + spec.precision = 1; + assertFormatError(123, spec, "Precision not allowed in integer format specifier"); + + spec.precision = -1; + spec.sign = '+'; + spec.type = 'c'; + assertFormatError(123, spec, "Sign not allowed with integer format specifier 'c'"); + + spec.sign = 0; + assertFormatError(0x11111, spec, "%c arg not in range(0x10000)"); + } + + public void testFormatString() { + InternalFormatSpec spec = new InternalFormatSpec(); + assertEquals("abc", PyString.formatString("abc", spec)); + + spec.precision = 3; + assertEquals("abc", PyString.formatString("abcdef", spec)); + + spec.precision = -1; + spec.width = 6; + assertEquals("abc ", PyString.formatString("abc", spec)); + } + + private void assertFormatError(int value, InternalFormatSpec spec, String expected) { + String error = null; + try { + PyInteger.formatIntOrLong(value, spec); + } catch (IllegalArgumentException e) { + error = e.getMessage(); + } + assertEquals(expected, error); + } + + public void testMarkupIterator() { + MarkupIterator iterator = new MarkupIterator("abc"); + assertEquals("abc", iterator.nextChunk().literalText); + assertNull(iterator.nextChunk()); + + iterator = new MarkupIterator("First, thou shalt count to {0}"); + MarkupIterator.Chunk chunk = iterator.nextChunk(); + assertEquals("First, thou shalt count to ", chunk.literalText); + assertEquals("0", chunk.fieldName); + assertNull(iterator.nextChunk()); + + iterator = new MarkupIterator("Weight in tons {0.weight!r:s}"); + chunk = iterator.nextChunk(); + assertEquals("Weight in tons ", chunk.literalText); + assertEquals("0.weight", chunk.fieldName); + assertEquals("r", chunk.conversion); + assertEquals("s", chunk.formatSpec); + + chunk = new MarkupIterator("{{").nextChunk(); + assertEquals("{", chunk.literalText); + + chunk = new MarkupIterator("}}").nextChunk(); + assertEquals("}", chunk.literalText); + + chunk = new MarkupIterator("{{}}").nextChunk(); + assertEquals("{}", chunk.literalText); + + chunk = new MarkupIterator("{0:.{1}}").nextChunk(); + assertEquals("0", chunk.fieldName); + assertEquals(".{1}", chunk.formatSpec); + assertTrue(chunk.formatSpecNeedsExpanding); + + assertMarkupError("{!}", "end of format while looking for conversion specifier"); + assertMarkupError("{!rrrr}", "expected ':' after conversion specifier"); + assertMarkupError("{", "Single '{' encountered in format string"); + assertMarkupError("}", "Single '}' encountered in format string"); + } + + private void assertMarkupError(String markup, String expected) { + MarkupIterator iterator = new MarkupIterator(markup); + String error = null; + try { + iterator.nextChunk(); + } catch (IllegalArgumentException e) { + error = e.getMessage(); + } + assertEquals(expected, error); + } + + public void testFieldNameIterator() { + FieldNameIterator it = new FieldNameIterator("abc"); + assertEquals("abc", it.head()); + assertNull(it.nextChunk()); + + it = new FieldNameIterator("3"); + assertEquals(3, it.head()); + assertNull(it.nextChunk()); + + it = new FieldNameIterator("abc[0]"); + assertEquals("abc", it.head()); + FieldNameIterator.Chunk chunk = it.nextChunk(); + assertEquals(0, chunk.value); + assertFalse(chunk.is_attr); + assertNull(it.nextChunk()); + + it = new FieldNameIterator("abc.def"); + assertEquals("abc", it.head()); + chunk = it.nextChunk(); + assertEquals("def", chunk.value); + assertTrue(chunk.is_attr); + assertNull(it.nextChunk()); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-24 20:12:52
|
Revision: 7266 http://jython.svn.sourceforge.net/jython/?rev=7266&view=rev Author: pjenvey Date: 2011-03-24 20:12:46 +0000 (Thu, 24 Mar 2011) Log Message: ----------- fix zipimporter subclasses not getting a __dict__ test from Yuji Yamano (thanks) Modified Paths: -------------- trunk/jython/Lib/test/test_zipimport_jy.py trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java trunk/jython/src/templates/zipimporter.derived Modified: trunk/jython/Lib/test/test_zipimport_jy.py =================================================================== --- trunk/jython/Lib/test/test_zipimport_jy.py 2011-03-24 20:11:52 UTC (rev 7265) +++ trunk/jython/Lib/test/test_zipimport_jy.py 2011-03-24 20:12:46 UTC (rev 7266) @@ -1,8 +1,8 @@ import unittest import sys import java.lang.Package - from test import test_support +from zipimport import zipimporter class SyspathZipimportTest(unittest.TestCase): def setUp(self): @@ -10,7 +10,7 @@ sys.path.insert(0, test_support.findfile("syspath_import.jar")) # TODO confirm that package is unloaded via a phantom ref or something like that - + def tearDown(self): sys.path = self.orig_path @@ -31,6 +31,17 @@ from syspathpkg import module self.assertEquals(module.__name__, 'syspathpkg.module') + def test_zipimporter_subclass(self): + class MyJavaClass(zipimporter): + def __init__(self): + zipimporter.__init__(self, test_support.findfile('zipdir.zip')) + self.bar = "bar" + + # Previously failed with AttributeError: 'MyJavaClass' object + # has no attribute 'bar' + obj = MyJavaClass() + self.assertTrue(isinstance(obj, zipimporter)) + def test_main(): test_support.run_unittest(SyspathZipimportTest) Modified: trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java =================================================================== --- trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java 2011-03-24 20:11:52 UTC (rev 7265) +++ trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java 2011-03-24 20:12:46 UTC (rev 7266) @@ -16,9 +16,33 @@ private PyObject[]slots; + private PyObject dict; + + public PyObject fastGetDict() { + return dict; + } + + public PyObject getDict() { + return dict; + } + + public void setDict(PyObject newDict) { + if (newDict instanceof PyStringMap||newDict instanceof PyDictionary) { + dict=newDict; + } else { + throw Py.TypeError("__dict__ must be set to a Dictionary "+newDict.getClass().getName()); + } + } + + public void delDict() { + // deleting an object's instance dict makes it grow a new one + dict=new PyStringMap(); + } + public zipimporterDerived(PyType subtype) { super(subtype); slots=new PyObject[subtype.getNumSlots()]; + dict=subtype.instDict(); } public PyString __str__() { Modified: trunk/jython/src/templates/zipimporter.derived =================================================================== --- trunk/jython/src/templates/zipimporter.derived 2011-03-24 20:11:52 UTC (rev 7265) +++ trunk/jython/src/templates/zipimporter.derived 2011-03-24 20:12:46 UTC (rev 7266) @@ -1,4 +1,4 @@ base_class: zipimporter -want_dict: false +want_dict: true ctr: incl: object This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2011-03-30 15:17:34
|
Revision: 7277 http://jython.svn.sourceforge.net/jython/?rev=7277&view=rev Author: fwierzbicki Date: 2011-03-30 15:17:27 +0000 (Wed, 30 Mar 2011) Log Message: ----------- Fix last of the rewrite astions that include -> ^(...) to be regular actions. Modified Paths: -------------- trunk/jython/grammar/Python.g trunk/jython/src/org/python/antlr/ast/Global.java trunk/jython/src/org/python/antlr/ast/ImportFrom.java Modified: trunk/jython/grammar/Python.g =================================================================== --- trunk/jython/grammar/Python.g 2011-03-30 02:58:28 UTC (rev 7276) +++ trunk/jython/grammar/Python.g 2011-03-30 15:17:27 UTC (rev 7277) @@ -901,19 +901,31 @@ //import_from: ('from' ('.'* dotted_name | '.'+) // 'import' ('*' | '(' import_as_names ')' | import_as_names)) import_from +@init { + stmt stype = null; +} +@after { + $import_from.tree = stype; +} : FROM (d+=DOT* dotted_name | d+=DOT+) IMPORT (STAR - -> ^(FROM<ImportFrom>[$FROM, actions.makeFromText($d, $dotted_name.names), - actions.makeModuleNameNode($d, $dotted_name.names), - actions.makeStarAlias($STAR), actions.makeLevel($d)]) + { + stype = new ImportFrom($FROM, actions.makeFromText($d, $dotted_name.names), + actions.makeModuleNameNode($d, $dotted_name.names), + actions.makeStarAlias($STAR), actions.makeLevel($d)); + } | i1=import_as_names - -> ^(FROM<ImportFrom>[$FROM, actions.makeFromText($d, $dotted_name.names), - actions.makeModuleNameNode($d, $dotted_name.names), - actions.makeAliases($i1.atypes), actions.makeLevel($d)]) + { + stype = new ImportFrom($FROM, actions.makeFromText($d, $dotted_name.names), + actions.makeModuleNameNode($d, $dotted_name.names), + actions.makeAliases($i1.atypes), actions.makeLevel($d)); + } | LPAREN i2=import_as_names COMMA? RPAREN - -> ^(FROM<ImportFrom>[$FROM, actions.makeFromText($d, $dotted_name.names), - actions.makeModuleNameNode($d, $dotted_name.names), - actions.makeAliases($i2.atypes), actions.makeLevel($d)]) + { + stype = new ImportFrom($FROM, actions.makeFromText($d, $dotted_name.names), + actions.makeModuleNameNode($d, $dotted_name.names), + actions.makeAliases($i2.atypes), actions.makeLevel($d)); + } ) ; @@ -971,8 +983,16 @@ //global_stmt: 'global' NAME (',' NAME)* global_stmt +@init { + stmt stype = null; +} +@after { + $global_stmt.tree = stype; +} : GLOBAL n+=NAME (COMMA n+=NAME)* - -> ^(GLOBAL<Global>[$GLOBAL, actions.makeNames($n), actions.makeNameNodes($n)]) + { + stype = new Global($GLOBAL, actions.makeNames($n), actions.makeNameNodes($n)); + } ; //exec_stmt: 'exec' expr ['in' test [',' test]] Modified: trunk/jython/src/org/python/antlr/ast/Global.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/Global.java 2011-03-30 02:58:28 UTC (rev 7276) +++ trunk/jython/src/org/python/antlr/ast/Global.java 2011-03-30 15:17:27 UTC (rev 7277) @@ -88,8 +88,8 @@ this.names = names; } - public Global(Integer ttype, Token token, java.util.List<String> names, java.util.List<Name> nameNodes) { - super(ttype, token); + public Global(Token token, java.util.List<String> names, java.util.List<Name> nameNodes) { + super(token); this.names = names; this.nameNodes = nameNodes; } Modified: trunk/jython/src/org/python/antlr/ast/ImportFrom.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ImportFrom.java 2011-03-30 02:58:28 UTC (rev 7276) +++ trunk/jython/src/org/python/antlr/ast/ImportFrom.java 2011-03-30 15:17:27 UTC (rev 7277) @@ -117,10 +117,10 @@ setLevel(level); } - public ImportFrom(int ttype, Token token, + public ImportFrom(Token token, String module, List<Name> moduleNames, List<alias> names, Integer level) { - super(ttype, token); + super(token); this.module = module; this.names = names; if (names == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2011-03-30 15:43:41
|
Revision: 7278 http://jython.svn.sourceforge.net/jython/?rev=7278&view=rev Author: otmarhumbel Date: 2011-03-30 15:43:34 +0000 (Wed, 30 Mar 2011) Log Message: ----------- upgrade most of the math module to 2.6 Modified Paths: -------------- trunk/jython/Lib/test/test_math_jy.py trunk/jython/src/org/python/compiler/Module.java trunk/jython/src/org/python/modules/math.java Added Paths: ----------- trunk/jython/tests/java/org/python/compiler/ trunk/jython/tests/java/org/python/compiler/ModuleTest.java trunk/jython/tests/java/org/python/core/PyFloatTest.java Modified: trunk/jython/Lib/test/test_math_jy.py =================================================================== --- trunk/jython/Lib/test/test_math_jy.py 2011-03-30 15:17:27 UTC (rev 7277) +++ trunk/jython/Lib/test/test_math_jy.py 2011-03-30 15:43:34 UTC (rev 7278) @@ -7,6 +7,7 @@ from test import test_support inf = float('inf') +ninf = float('-inf') nan = float('nan') class MathTestCase(unittest.TestCase): @@ -17,7 +18,17 @@ self.assertNotEqual(mantissa, mantissa) self.assertEqual(exponent, 0) + def test_fmod(self): + self.assertEqual(-1e-100, math.fmod(-1e-100, 1e100)) + def test_hypot(self): + self.assert_(math.isnan(math.hypot(nan, nan))) + self.assertEqual(inf, math.hypot(inf, 4)) + self.assertEqual(inf, math.hypot(4, inf)) + self.assertEqual(inf, math.hypot(ninf, 4)) + self.assertEqual(inf, math.hypot(4, ninf)) + + def test_main(): test_support.run_unittest(MathTestCase) Modified: trunk/jython/src/org/python/compiler/Module.java =================================================================== --- trunk/jython/src/org/python/compiler/Module.java 2011-03-30 15:17:27 UTC (rev 7277) +++ trunk/jython/src/org/python/compiler/Module.java 2011-03-30 15:43:34 UTC (rev 7278) @@ -72,7 +72,8 @@ } class PyFloatConstant extends Constant implements ClassConstants, Opcodes { - + private static final double ZERO = 0.0; + final double value; PyFloatConstant(double value) { @@ -98,10 +99,14 @@ @Override public boolean equals(Object o) { if (o instanceof PyFloatConstant) { - return ((PyFloatConstant) o).value == value; - } else { - return false; + double oVal = ((PyFloatConstant)o).value; + if (ZERO == value) { + // math.copysign() needs to distinguish signs of zeroes + return oVal == value && Double.toString(oVal).equals(Double.toString(value)); + } + return oVal == value; } + return false; } } Modified: trunk/jython/src/org/python/modules/math.java =================================================================== --- trunk/jython/src/org/python/modules/math.java 2011-03-30 15:17:27 UTC (rev 7277) +++ trunk/jython/src/org/python/modules/math.java 2011-03-30 15:43:34 UTC (rev 7278) @@ -1,6 +1,8 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.modules; +import java.math.BigInteger; + import org.python.core.ClassDictInit; import org.python.core.Py; import org.python.core.PyFloat; @@ -9,46 +11,127 @@ import org.python.core.PyObject; import org.python.core.PyTuple; +// +// +++++ test the corner cases for every method again (e.g. test_math_jy.py) +// + public class math implements ClassDictInit { public static PyFloat pi = new PyFloat(Math.PI); public static PyFloat e = new PyFloat(Math.E); + + private static final double ZERO = 0.0; + private static final double MINUS_ZERO = -0.0; + private static final double HALF = 0.5; + private static final double ONE = 1.0; + private static final double MINUS_ONE = -1.0; + private static final double TWO = 2.0; + private static final double EIGHT = 8.0; + private static final double INF = Double.POSITIVE_INFINITY; + private static final double NINF = Double.NEGATIVE_INFINITY; + private static final double NAN = Double.NaN; + private static final BigInteger MAX_LONG_BIGINTEGER = new BigInteger(String.valueOf(Long.MAX_VALUE)); + private static final BigInteger MIN_LONG_BIGINTEGER = new BigInteger(String.valueOf(Long.MIN_VALUE)); - public static void classDictInit(PyObject dict) { - } - private static double check(double v) { - if (Double.isNaN(v)) - throw Py.ValueError("math domain error"); - if (Double.isInfinite(v)) - throw Py.OverflowError("math range error"); - return v; + public static void classDictInit(@SuppressWarnings("unused") PyObject dict) { } public static double acos(double v) { - return check(Math.acos(v)); + if (isinf(v)) { + throwMathDomainValueError(); + } + if (isnan(v)) { + return v; + } + return Math.acos(v); } + + public static double acosh(double v) { + if (isninf(v)) { + throwMathDomainValueError(); + } + if (v == ZERO || v == MINUS_ONE) { + throwMathDomainValueError(); + } + if (isnan(v) || isinf(v)) { + return v; + } + return log(v + sqrt(v * v - 1)); + } public static double asin(double v) { - return check(Math.asin(v)); + if (isinf(v)) { + throwMathDomainValueError(); + } + if (isnan(v)) { + return v; + } + return Math.asin(v); } + + public static double asinh(double v) { + if (isnan(v) || isinf(v)) { + return v; + } + return log(v + sqrt(v * v + 1)); + } public static double atan(double v) { - return check(Math.atan(v)); + if (isnan(v)) { + return v; + } + return Math.atan(v); } + + public static double atanh(double v) { + if (isnan(v)) { + return v; + } + if (isinf(v) || Math.abs(v) == ONE) { + throwMathDomainValueError(); + } + return log((1 + v) / (1 - v)) / 2; + } public static double atan2(double v, double w) { - return check(Math.atan2(v, w)); + return Math.atan2(v, w); } + public static double ceil(PyObject v) { + return ceil(v.asDouble()); + } + public static double ceil(double v) { - return check(Math.ceil(v)); + if (isnan(v) || isinf(v)) { + return v; + } + return Math.ceil(v); } public static double cos(double v) { - return check(Math.cos(v)); + if (isnan(v) || isinf(v)) { + return NAN; + } + return Math.cos(v); } + public static double cosh(double v) { + if (isinf(v)) { + return INF; + } + if (isnan(v)) { + return v; + } + return HALF * (Math.exp(v) + Math.exp(-v)); + } + public static double exp(double v) { + if (isninf(v)) { + return ZERO; + } + if (isnan(v) || isinf(v)) { + return v; + } return check(Math.exp(v)); } @@ -57,7 +140,10 @@ } public static double floor(double v) { - return check(Math.floor(v)); + if (isnan(v) || isinf(v)) { + return v; + } + return Math.floor(v); } public static double log(PyObject v) { @@ -77,37 +163,83 @@ return doubleValue; } - private static double calculateLongLog(PyLong v) { - int e[] = new int[1]; - double x = v.scaledDoubleValue(e); - if (x <= 0.0) throw Py.ValueError("math domain error"); - return log(x) + (e[0]*8.0)*log(2.0); - } - - private static double applyLoggedBase(double loggedValue, PyObject base) { - double loggedBase; - if (base instanceof PyLong) { - loggedBase = calculateLongLog((PyLong)base); - } else { - loggedBase = log(base.asDouble()); + public static double pow(double v, double w) { + if (w == ZERO) { + return ONE; } - return check(loggedValue / loggedBase); + if (v == ONE) { + return v; + } + if (isnan(v) || isnan(w)) { + return NAN; + } + if (v == ZERO) { + if (w == ZERO) { + return ONE; + } else if (w > ZERO || ispinf(w)) { + return ZERO; + } else { + throwMathDomainValueError(); + } + } + if (isninf(v)) { + if (isninf(w)) { + return ZERO; + } + if (isinf(w)) { + return INF; + } + if (w == ZERO) { + return ONE; + } + if (w > ZERO) { + if (isOdd(w)) { + return NINF; + } + return INF; + } + if (isOdd(w)) { + return MINUS_ZERO; + } + return ZERO; + } + if (isninf(w)) { + if (v < ZERO) { + if (v == MINUS_ONE) { + return ONE; + } + if (v < MINUS_ONE) { + return ZERO; + } + return INF; + } + } + if (ispinf(w)) { + if (v < ZERO) { + if (v == MINUS_ONE) { + return ONE; + } + if (v < MINUS_ONE) { + return INF; + } + return ZERO; + } + } + if (v < ZERO && !isIntegral(w)) { + throwMathDomainValueError(); + } + return Math.pow(v, w); } - private static double log(double v) { - return check(Math.log(v)); - } - - public static double pow(double v, double w) { - return check(Math.pow(v, w)); - } - public static double sin(PyObject v) { return sin(v.asDouble()); } public static double sin(double v) { - return check(Math.sin(v)); + if (isnan(v)) { + return v; + } + return Math.sin(v); } public static double sqrt(PyObject v) { @@ -115,37 +247,61 @@ } public static double sqrt(double v) { - return check(Math.sqrt(v)); + if (isnan(v)) { + return v; + } + if (ispinf(v)) { + return v; + } + if (isninf(v) || v == MINUS_ONE) { + throwMathDomainValueError(); + } + return Math.sqrt(v); } public static double tan(double v) { - return check(Math.tan(v)); + if (isnan(v) || isinf(v)) { + return NAN; + } + return Math.tan(v); } public static double log10(PyObject v) { if (v instanceof PyLong) { - int e[] = new int[1]; - double x = ((PyLong)v).scaledDoubleValue(e); - if (x <= 0.0) throw Py.ValueError("math domain error"); - return log10(x) + (e[0]*8.0)*log10(2.0); + int exp[] = new int[1]; + double x = ((PyLong)v).scaledDoubleValue(exp); + if (x <= ZERO) { + throwMathDomainValueError(); + } + return log10(x) + (exp[0] * EIGHT) * log10(TWO); } return log10(v.asDouble()); } - private static double log10(double v) { - return check(Math.log10(v)); - } - public static double sinh(double v) { - return check(0.5 * (Math.exp(v) - Math.exp(-v))); + if (isnan(v)) { + return v; + } + if (isinf(v)) { + return v; + } + return HALF * (Math.exp(v) - Math.exp(-v)); } - public static double cosh(double v) { - return check(0.5 * (Math.exp(v) + Math.exp(-v))); - } - public static double tanh(double v) { - return check(sinh(v) / cosh(v)); + if (isnan(v)) { + return v; + } + if (isinf(v)) { + if (isninf(v)) { + return MINUS_ONE; + } + return ONE; + } + if (v == MINUS_ZERO) { + return v; + } + return sinh(v) / cosh(v); } public static double fabs(double v) { @@ -153,11 +309,33 @@ } public static double fmod(double v, double w) { + if (isnan(v) || isnan(w)) { + return NAN; + } + if (isinf(w)) { + return v; + } + if (w == ZERO) { + throwMathDomainValueError(); + } + if (isinf(v) && w == ONE) { + throwMathDomainValueError(); + } return v % w; } public static PyTuple modf(double v) { - double w = v % 1.0; + if (isnan(v)) { + return new PyTuple(new PyFloat(v), new PyFloat(v)); + } + if (isinf(v)) { + double first = ZERO; + if (isninf(v)) { + first = MINUS_ZERO; + } + return new PyTuple(new PyFloat(first), new PyFloat(v)); + } + double w = v % ONE; v -= w; return new PyTuple(new PyFloat(w), new PyFloat(v)); } @@ -165,39 +343,228 @@ public static PyTuple frexp(double x) { int exponent = 0; - if (Double.isNaN(x) || Double.isInfinite(x) || x == 0.0) { + if (isnan(x) || isinf(x) || x == ZERO) { exponent = 0; } else { short sign = 1; - if (x < 0.0) { + if (x < ZERO) { x = -x; sign = -1; } + + for (; x < HALF; x *= TWO, exponent--); // needs an empty statement - for (; x < 0.5; x *= 2.0, exponent--); + for (; x >= ONE; x *= HALF, exponent++); // needs an empty statement - for (; x >= 1.0; x *= 0.5, exponent++); - x *= sign; } return new PyTuple(new PyFloat(x), new PyInteger(exponent)); } public static double ldexp(double v, PyObject wObj) { - int w = wObj.asInt(); - return check(v * Math.pow(2.0, w)); + if (ZERO == v) { + return v; // can be negative zero + } + if (isinf(v)) { + return v; + } + if (isnan(v)) { + return v; + } + long w = getLong(wObj); + if (w == Long.MIN_VALUE) { + if (v > ZERO) { + return ZERO; + } + return MINUS_ZERO; + } + return checkOverflow(v * Math.pow(TWO, w)); } public static double hypot(double v, double w) { - return check(Math.hypot(v, w)); + if (isinf(v) || isinf(w)) { + return INF; + } + if (isnan(v) || isnan(w)) { + return NAN; + } + return Math.hypot(v, w); } public static double radians(double v) { - return check(Math.toRadians(v)); + return check(Math.toRadians(v)); } public static double degrees(double v) { - return check(Math.toDegrees(v)); + return check(Math.toDegrees(v)); } + + public static boolean isnan(double v) { + return Double.isNaN(v); + } + + /** + * @param v + * + * @return <code>true</code> if v is positive or negative infinity + */ + public static boolean isinf(double v) { + return Double.isInfinite(v); + } + + public static double copysign(double v, double w) { + if (isnan(v)) { + return NAN; + } + if (signum(v) == signum(w)) { + return v; + } + return v *= MINUS_ONE; + } + + public static PyLong factorial(double v) { + if (v == ZERO || v == ONE) { + return new PyLong(1); + } + if (v < ZERO || isnan(v) || isinf(v)) { + throwMathDomainValueError(); + } + if (!isIntegral(v)) { + throwMathDomainValueError(); + } + // long input should be big enough :-) + long value = (long)v; + BigInteger bi = new BigInteger(Long.toString(value)); + for (long l = value - 1; l > 1; l--) { + bi = bi.multiply(new BigInteger(Long.toString(l))); + } + return new PyLong(bi); + } + + public static double log1p(double v) { + return log(ONE + v); + } + + public static double fsum(double... values) { + // TODO need an iterable + // TODO need sys.float_info + return 0; + } + + private static double calculateLongLog(PyLong v) { + int exp[] = new int[1]; + double x = v.scaledDoubleValue(exp); + if (x <= ZERO) { + throwMathDomainValueError(); + } + return log(x) + (exp[0] * EIGHT) * log(TWO); + } + + private static double applyLoggedBase(double loggedValue, PyObject base) { + double loggedBase; + if (base instanceof PyLong) { + loggedBase = calculateLongLog((PyLong)base); + } else { + loggedBase = log(base.asDouble()); + } + return check(loggedValue / loggedBase); + } + + private static double log(double v) { + if (isninf(v)) { + throwMathDomainValueError(); + } + if (isinf(v) || isnan(v)) { + return v; + } + return Math.log(v); + } + + private static double log10(double v) { + if (isninf(v)) { + throwMathDomainValueError(); + } + if (isinf(v) || isnan(v)) { + return v; + } + return Math.log10(v); + } + + private static boolean isninf(double v) { + return v == NINF; + } + + private static boolean ispinf(double v) { + return v == INF; + } + + /** + * work around special Math.signum() behaviour for positive and negative zero + */ + private static double signum(double v) { + double signum = ONE; + if (v == ZERO) { + if ('-' == Double.toString(v).charAt(0)) { + signum = MINUS_ONE; + } + } else { + signum = Math.signum(v); + } + return signum; + } + + private static void throwMathDomainValueError() { + throw Py.ValueError("math domain error"); + } + + private static double check(double v) { + if (isnan(v)) + throwMathDomainValueError(); + if (isinf(v)) + throw Py.OverflowError("math range error"); + return v; + } + + private static double checkOverflow(double v) { + if (isinf(v)) { + throw Py.OverflowError("math range error"); + } + return v; + } + + /** + * convert a PyObject into a long between Long.MIN_VALUE and Long.MAX_VALUE + */ + private static long getLong(PyObject pyo) { + if (pyo instanceof PyLong) { + return getLong(((PyLong)pyo)); + } + return pyo.asLong(); + } + + /** + * convert a PyLong into a long between Long.MIN_VALUE and Long.MAX_VALUE + */ + private static long getLong(PyLong pyLong) { + BigInteger value = pyLong.getValue(); + if (value.compareTo(MAX_LONG_BIGINTEGER) > 0) { + return Long.MAX_VALUE; + } + if (value.compareTo(MIN_LONG_BIGINTEGER) < 0) { + return Long.MIN_VALUE; + } + return value.longValue(); + } + + + private static boolean isIntegral(double v) { + return ceil(v) - v == ZERO; + } + + + private static boolean isOdd(double v) { + return isIntegral(v) && v % TWO != ZERO; + } + } Added: trunk/jython/tests/java/org/python/compiler/ModuleTest.java =================================================================== --- trunk/jython/tests/java/org/python/compiler/ModuleTest.java (rev 0) +++ trunk/jython/tests/java/org/python/compiler/ModuleTest.java 2011-03-30 15:43:34 UTC (rev 7278) @@ -0,0 +1,21 @@ +package org.python.compiler; + +import junit.framework.TestCase; + +public class ModuleTest extends TestCase { + + /** + * In order to get testCopysign() in test_math.py passing, PyFloatConstant needs to distinguish + * between 0.0 and -0.0: + * + * <pre> + * # copysign should let us distinguish signs of zeros + * </pre> + */ + public void testPyFloatConstant_Zero() { + PyFloatConstant positiveZero = new PyFloatConstant(0.0); + PyFloatConstant negativeZero = new PyFloatConstant(-0.0); + assertNotSame(positiveZero, negativeZero); + assertFalse(positiveZero.equals(negativeZero)); + } +} Added: trunk/jython/tests/java/org/python/core/PyFloatTest.java =================================================================== --- trunk/jython/tests/java/org/python/core/PyFloatTest.java (rev 0) +++ trunk/jython/tests/java/org/python/core/PyFloatTest.java 2011-03-30 15:43:34 UTC (rev 7278) @@ -0,0 +1,63 @@ +package org.python.core; + +import junit.framework.TestCase; + +public class PyFloatTest extends TestCase { + + private final static double nan = Double.NaN; + + private final static double inf = Double.POSITIVE_INFINITY; + + private final static double ninf = Double.NEGATIVE_INFINITY; + + /** + * test the basic behavior of java.lang.Double extreme values + */ + public void test_Double_InfinityAndNaN() { + assertTrue(Double.NaN != nan); // this is the definition of NaN + assertTrue(Double.isNaN(nan)); + assertFalse(Double.isInfinite(nan)); + assertTrue(Double.POSITIVE_INFINITY == inf); + assertFalse(Double.isNaN(inf)); + assertTrue(Double.isInfinite(inf)); + assertTrue(Double.NEGATIVE_INFINITY == ninf); + assertFalse(Double.isNaN(ninf)); + assertTrue(Double.isInfinite(ninf)); + assertTrue(nan != inf); + assertTrue(nan != ninf); + assertTrue(inf != ninf); + } + + /** + * test extreme values + */ + public void testInfinityAndNaN() { + PyFloat fNan = new PyFloat(Double.NaN); + PyFloat fInf = new PyFloat(Double.POSITIVE_INFINITY); + PyFloat fNinf = new PyFloat(Double.NEGATIVE_INFINITY); + assertTrue(Double.NaN != fNan.getValue()); // this is the definition of NaN + assertTrue(Double.isNaN(fNan.getValue())); + assertFalse(Double.isInfinite(fNan.getValue())); + assertTrue(Double.POSITIVE_INFINITY == fInf.getValue()); + assertFalse(Double.isNaN(fInf.getValue())); + assertTrue(Double.isInfinite(fInf.getValue())); + assertTrue(Double.NEGATIVE_INFINITY == fNinf.getValue()); + assertFalse(Double.isNaN(fNinf.getValue())); + assertTrue(Double.isInfinite(fNinf.getValue())); + assertTrue(fNan.getValue() != fInf.getValue()); + assertTrue(fNan.getValue() != fNinf.getValue()); + assertTrue(fInf.getValue() != fNinf.getValue()); + } + + /** + * test formatting of extreme values + */ + public void testInfinityAndNaN_repr() { + PyFloat fNan = new PyFloat(Double.NaN); + PyFloat fInf = new PyFloat(Double.POSITIVE_INFINITY); + PyFloat fNinf = new PyFloat(Double.NEGATIVE_INFINITY); + assertEquals("nan", String.valueOf(fNan.__repr__())); + assertEquals("inf", String.valueOf(fInf.__repr__())); + assertEquals("-inf", String.valueOf(fNinf.__repr__())); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-04-01 05:22:45
|
Revision: 7280 http://jython.svn.sourceforge.net/jython/?rev=7280&view=rev Author: pjenvey Date: 2011-04-01 05:22:39 +0000 (Fri, 01 Apr 2011) Log Message: ----------- auto-toggle hg/svn version support Modified Paths: -------------- trunk/jython/build.xml trunk/jython/src/org/python/Version.java Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2011-03-30 15:55:44 UTC (rev 7279) +++ trunk/jython/build.xml 2011-04-01 05:22:39 UTC (rev 7280) @@ -393,38 +393,56 @@ </svn> </target> - <!-- XXX: could attempt to utilize subwcrev.exe to get the revision on Windows --> - <target name="svnversion" if="os.family.unix"> - <exec executable="svnversion" failifexecutionfails="false" outputproperty="build.svn.revision"/> + <target name="check-hg"> + <available file=".hg" type="dir" property="hg.present"/> + <condition property="hg-run"> + <and> + <isset property="hg.present"/> + <!-- XXX: Might this work on Windows? --> + <isset property="os.family.unix"/> + </and> + </condition> </target> + <target name="hg-id" depends="check-hg, hg-branch, hg-tag, hg-version"/> - <!-- XXX: Might this work on Windows? --> - <target name="hg-branch" if="os.family.unix"> + <target name="hg-branch" if="hg-run"> <exec executable="hg" failifexecutionfails="false" outputproperty="build.hg.branch"> <arg line="id -b"/> </exec> </target> - <target name="hg-tag" if="os.family.unix"> + <target name="hg-tag" if="hg-run"> <exec executable="hg" failifexecutionfails="false" outputproperty="build.hg.tag"> <arg line="id -t"/> </exec> </target> - <target name="hg-version" if="os.family.unix"> + <target name="hg-version" if="hg-run"> <exec executable="hg" failifexecutionfails="false" outputproperty="build.hg.version"> <arg line="id -i"/> </exec> </target> - <target name="hg-id" depends="hg-branch, hg-tag, hg-version"/> + <target name="svnversion-check" depends="check-hg"> + <condition property="svnversion-run"> + <and> + <not> + <isset property="hg.present"/> + </not> + <!-- XXX: could attempt to utilize subwcrev.exe to get the revision on Windows --> + <isset property="os.family.unix"/> + </and> + </condition> + </target> + <target name="svnversion" depends="svnversion-check" if="svnversion-run"> + <exec executable="svnversion" failifexecutionfails="false" outputproperty="build.svn.revision"/> + </target> + <!-- skip-brand can be set in ant.properties or as a system property to keep from updating the version.properties file and making the jar on every developer build. --> - <!-- when hg: - <target name="brand-version" depends="init, hg-id" unless="skip-brand">--> - <target name="brand-version" depends="init, svnversion" unless="skip-brand"> - <property name="build.svn.revision" value=""/> + <target name="brand-version" depends="init, hg-id, svnversion" unless="skip-brand"> <property name="build.hg.branch" value=""/> <property name="build.hg.tag" value=""/> <property name="build.hg.version" value=""/> + <property name="build.svn.revision" value=""/> <tstamp> <format property="build.date" pattern="MMM d yyyy" offset="0"/> <format property="build.time" pattern="HH:mm:ss" offset="0"/> Modified: trunk/jython/src/org/python/Version.java =================================================================== --- trunk/jython/src/org/python/Version.java 2011-03-30 15:55:44 UTC (rev 7279) +++ trunk/jython/src/org/python/Version.java 2011-04-01 05:22:39 UTC (rev 7280) @@ -167,6 +167,9 @@ * timestamp. */ public static String getBuildInfo() { + if (HG_VERSION != null && !"".equals(HG_VERSION)) { + return getBuildInfoHG(); + } String revision = getSubversionRevision(); String sep = "".equals(revision) ? "" : ":"; String branch = getSubversionShortBranch(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-04-01 18:44:21
|
Revision: 7282 http://jython.svn.sourceforge.net/jython/?rev=7282&view=rev Author: pjenvey Date: 2011-04-01 18:44:14 +0000 (Fri, 01 Apr 2011) Log Message: ----------- remove ancient .cvsignores (thanks Dmitry Jemerov), add .hgignore Added Paths: ----------- trunk/jython/.hgignore Removed Paths: ------------- trunk/jython/Lib/.cvsignore trunk/jython/Lib/pawt/.cvsignore trunk/jython/Lib/test/.cvsignore trunk/jython/Misc/.cvsignore trunk/jython/Misc/htgen/.cvsignore trunk/jython/bugtests/.cvsignore trunk/jython/src/org/python/compiler/.cvsignore trunk/jython/src/org/python/core/.cvsignore trunk/jython/src/org/python/modules/.cvsignore trunk/jython/src/org/python/modules/sre/.cvsignore trunk/jython/src/org/python/util/.cvsignore trunk/jython/src/templates/.cvsignore trunk/jython/tests/java/javatests/.cvsignore Added: trunk/jython/.hgignore =================================================================== --- trunk/jython/.hgignore (rev 0) +++ trunk/jython/.hgignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -0,0 +1,27 @@ +syntax: glob +*.class +*.pyc +*.pyd +*.pyo +*.orig +*.rej +*.swp +*~ +# IntelliJ files +*.ipr +*.iml +*.iws + +.AppleDouble +.DS_Store +.classpath +.externalToolBuilders +.project +.settings +__pycache__ +ant.properties +bin +build +cachedir +dist +profile.txt Deleted: trunk/jython/Lib/.cvsignore =================================================================== --- trunk/jython/Lib/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/Lib/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1 +0,0 @@ -*.class Deleted: trunk/jython/Lib/pawt/.cvsignore =================================================================== --- trunk/jython/Lib/pawt/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/Lib/pawt/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1 +0,0 @@ -*.class Deleted: trunk/jython/Lib/test/.cvsignore =================================================================== --- trunk/jython/Lib/test/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/Lib/test/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1 +0,0 @@ -*.class Deleted: trunk/jython/Misc/.cvsignore =================================================================== --- trunk/jython/Misc/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/Misc/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1,2 +0,0 @@ -*.pyc -*.class \ No newline at end of file Deleted: trunk/jython/Misc/htgen/.cvsignore =================================================================== --- trunk/jython/Misc/htgen/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/Misc/htgen/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1,2 +0,0 @@ -*.pyc -*.class \ No newline at end of file Deleted: trunk/jython/bugtests/.cvsignore =================================================================== --- trunk/jython/bugtests/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/bugtests/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1,7 +0,0 @@ -*.jar *.class *.out *.tmp *.ser *.pyc *.err jpywork cachedir support_config.py *.zip *.diff - -.classpath -.project -.ipr -.iws -.iml Deleted: trunk/jython/src/org/python/compiler/.cvsignore =================================================================== --- trunk/jython/src/org/python/compiler/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/src/org/python/compiler/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1,2 +0,0 @@ -.AppleDouble -*.class Deleted: trunk/jython/src/org/python/core/.cvsignore =================================================================== --- trunk/jython/src/org/python/core/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/src/org/python/core/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1,2 +0,0 @@ -.AppleDouble -*.class Deleted: trunk/jython/src/org/python/modules/.cvsignore =================================================================== --- trunk/jython/src/org/python/modules/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/src/org/python/modules/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1,2 +0,0 @@ -.AppleDouble -*.class Deleted: trunk/jython/src/org/python/modules/sre/.cvsignore =================================================================== --- trunk/jython/src/org/python/modules/sre/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/src/org/python/modules/sre/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1 +0,0 @@ -*.class Deleted: trunk/jython/src/org/python/util/.cvsignore =================================================================== --- trunk/jython/src/org/python/util/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/src/org/python/util/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1,2 +0,0 @@ -.AppleDouble -*.class Deleted: trunk/jython/src/templates/.cvsignore =================================================================== --- trunk/jython/src/templates/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/src/templates/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1 +0,0 @@ -*.pyc Deleted: trunk/jython/tests/java/javatests/.cvsignore =================================================================== --- trunk/jython/tests/java/javatests/.cvsignore 2011-04-01 18:35:36 UTC (rev 7281) +++ trunk/jython/tests/java/javatests/.cvsignore 2011-04-01 18:44:14 UTC (rev 7282) @@ -1 +0,0 @@ -*.class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-04-03 00:55:29
|
Revision: 7285 http://jython.svn.sourceforge.net/jython/?rev=7285&view=rev Author: pjenvey Date: 2011-04-03 00:55:23 +0000 (Sun, 03 Apr 2011) Log Message: ----------- fix os.stat(*(path,)) (when called with varargs, #1727) fix from agronholm Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/modules/posix/PosixModule.java Added Paths: ----------- trunk/jython/Lib/test/test_os_jy.py Added: trunk/jython/Lib/test/test_os_jy.py =================================================================== --- trunk/jython/Lib/test/test_os_jy.py (rev 0) +++ trunk/jython/Lib/test/test_os_jy.py 2011-04-03 00:55:23 UTC (rev 7285) @@ -0,0 +1,26 @@ +"""Misc os module tests + +Made for Jython. +""" +import os +import unittest +from test import test_support + +class OSTestCase(unittest.TestCase): + + def setUp(self): + open(test_support.TESTFN, 'w').close() + + def tearDown(self): + os.remove(test_support.TESTFN) + + def test_issue1727(self): + os.stat(*(test_support.TESTFN,)) + + +def test_main(): + test_support.run_unittest(OSTestCase) + + +if __name__ == '__main__': + test_main() Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-04-01 18:58:57 UTC (rev 7284) +++ trunk/jython/NEWS 2011-04-03 00:55:23 UTC (rev 7285) @@ -1,5 +1,9 @@ Jython NEWS +Jython 2.6a1 + Bugs Fixed + - [ 1727 ] Error in Jython 2.5.2 with os.stat and varargs + Jython 2.5.2 same as 2.5.2rc4 Modified: trunk/jython/src/org/python/modules/posix/PosixModule.java =================================================================== --- trunk/jython/src/org/python/modules/posix/PosixModule.java 2011-04-01 18:58:57 UTC (rev 7284) +++ trunk/jython/src/org/python/modules/posix/PosixModule.java 2011-04-03 00:55:23 UTC (rev 7285) @@ -24,7 +24,7 @@ import org.python.core.ClassDictInit; import org.python.core.Py; -import org.python.core.PyBuiltinFunction; +import org.python.core.PyBuiltinFunctionNarrow; import org.python.core.PyDictionary; import org.python.core.PyException; import org.python.core.PyFile; @@ -34,7 +34,6 @@ import org.python.core.PyObject; import org.python.core.PyString; import org.python.core.PyTuple; -import org.python.core.ThreadState; import org.python.core.imp; import org.python.core.io.IOBase; import org.python.core.io.FileDescriptors; @@ -929,15 +928,15 @@ return os.getModuleName(); } - static class LstatFunction extends PyBuiltinFunction { + static class LstatFunction extends PyBuiltinFunctionNarrow { LstatFunction() { - super("lstat", + super("lstat", 1, 1, "lstat(path) -> stat result\n\n" + "Like stat(path), but do not follow symbolic links."); } @Override - public PyObject __call__(ThreadState state, PyObject pathObj) { + public PyObject __call__(PyObject pathObj) { if (!(pathObj instanceof PyString)) { throw Py.TypeError(String.format("coercing to Unicode: need string or buffer, %s " + "found", pathObj.getType().fastGetName())); @@ -947,9 +946,9 @@ } } - static class StatFunction extends PyBuiltinFunction { + static class StatFunction extends PyBuiltinFunctionNarrow { StatFunction() { - super("stat", + super("stat", 1, 1, "stat(path) -> stat result\n\n" + "Perform a stat system call on the given path.\n\n" + "Note that some platforms may return only a small subset of the\n" + @@ -957,7 +956,7 @@ } @Override - public PyObject __call__(ThreadState state, PyObject pathObj) { + public PyObject __call__(PyObject pathObj) { if (!(pathObj instanceof PyString)) { throw Py.TypeError(String.format("coercing to Unicode: need string or buffer, %s " + "found", pathObj.getType().fastGetName())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-04-23 00:18:02
|
Revision: 7287 http://jython.svn.sourceforge.net/jython/?rev=7287&view=rev Author: pjenvey Date: 2011-04-23 00:17:56 +0000 (Sat, 23 Apr 2011) Log Message: ----------- fix os.read returning unicode instead of str fixes #1735 Modified Paths: -------------- trunk/jython/Lib/test/test_fileno.py trunk/jython/NEWS trunk/jython/src/org/python/modules/posix/PosixModule.java Modified: trunk/jython/Lib/test/test_fileno.py =================================================================== --- trunk/jython/Lib/test/test_fileno.py 2011-04-03 00:59:11 UTC (rev 7286) +++ trunk/jython/Lib/test/test_fileno.py 2011-04-23 00:17:56 UTC (rev 7287) @@ -46,7 +46,9 @@ self.fp.write('jython filenos') self.fp.flush() self.fp.seek(0) - self.assertEqual(os.read(self.fd, 7), 'jython ') + result = os.read(self.fd, 7) + self.assertTrue(isinstance(result, str)) + self.assertEqual(result, 'jython ') self.assertEqual(os.read(self.fd, 99), 'filenos') self.fp.close() raises(OSError, 9, os.read, self.fd, 1) Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2011-04-03 00:59:11 UTC (rev 7286) +++ trunk/jython/NEWS 2011-04-23 00:17:56 UTC (rev 7287) @@ -3,6 +3,7 @@ Jython 2.6a1 Bugs Fixed - [ 1727 ] Error in Jython 2.5.2 with os.stat and varargs + - [ 1735 ] return type of os.read is unicode, not str Jython 2.5.2 same as 2.5.2rc4 Modified: trunk/jython/src/org/python/modules/posix/PosixModule.java =================================================================== --- trunk/jython/src/org/python/modules/posix/PosixModule.java 2011-04-03 00:59:11 UTC (rev 7286) +++ trunk/jython/src/org/python/modules/posix/PosixModule.java 2011-04-23 00:17:56 UTC (rev 7287) @@ -609,9 +609,9 @@ public static PyString __doc__read = new PyString( "read(fd, buffersize) -> string\n\n" + "Read a file descriptor."); - public static String read(PyObject fd, int buffersize) { + public static PyObject read(PyObject fd, int buffersize) { try { - return StringUtil.fromBytes(FileDescriptors.get(fd).read(buffersize)); + return new PyString(StringUtil.fromBytes(FileDescriptors.get(fd).read(buffersize))); } catch (PyException pye) { throw badFD(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-04-30 23:27:57
|
Revision: 7289 http://jython.svn.sourceforge.net/jython/?rev=7289&view=rev Author: pjenvey Date: 2011-04-30 23:27:49 +0000 (Sat, 30 Apr 2011) Log Message: ----------- remove svn keywords in comments Modified Paths: -------------- trunk/jython/Lib/dbexts.py trunk/jython/Lib/isql.py trunk/jython/Lib/test/zxjdbc/dbextstest.py trunk/jython/Lib/test/zxjdbc/jndi.py trunk/jython/Lib/test/zxjdbc/runner.py trunk/jython/Lib/test/zxjdbc/sptest.py trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py trunk/jython/Lib/test/zxjdbc/zxtest.py trunk/jython/src/com/ziclix/python/sql/DBApiType.java trunk/jython/src/com/ziclix/python/sql/DataHandler.java trunk/jython/src/com/ziclix/python/sql/DateFactory.java trunk/jython/src/com/ziclix/python/sql/Fetch.java trunk/jython/src/com/ziclix/python/sql/FilterDataHandler.java trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java trunk/jython/src/com/ziclix/python/sql/JDBC30DataHandler.java trunk/jython/src/com/ziclix/python/sql/JavaDateFactory.java trunk/jython/src/com/ziclix/python/sql/Jython22DataHandler.java trunk/jython/src/com/ziclix/python/sql/Procedure.java trunk/jython/src/com/ziclix/python/sql/PyConnection.java trunk/jython/src/com/ziclix/python/sql/PyCursor.java trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java trunk/jython/src/com/ziclix/python/sql/PyStatement.java trunk/jython/src/com/ziclix/python/sql/WarningEvent.java trunk/jython/src/com/ziclix/python/sql/WarningListener.java trunk/jython/src/com/ziclix/python/sql/connect/Connect.java trunk/jython/src/com/ziclix/python/sql/connect/Connectx.java trunk/jython/src/com/ziclix/python/sql/connect/Lookup.java trunk/jython/src/com/ziclix/python/sql/handler/InformixDataHandler.java trunk/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java trunk/jython/src/com/ziclix/python/sql/handler/OracleDataHandler.java trunk/jython/src/com/ziclix/python/sql/handler/PostgresqlDataHandler.java trunk/jython/src/com/ziclix/python/sql/handler/RowIdHandler.java trunk/jython/src/com/ziclix/python/sql/handler/SQLServerDataHandler.java trunk/jython/src/com/ziclix/python/sql/handler/UpdateCountDataHandler.java trunk/jython/src/com/ziclix/python/sql/pipe/Pipe.java trunk/jython/src/com/ziclix/python/sql/pipe/Sink.java trunk/jython/src/com/ziclix/python/sql/pipe/Source.java trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVSink.java trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVString.java trunk/jython/src/com/ziclix/python/sql/pipe/db/BaseDB.java trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSink.java trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSource.java trunk/jython/src/com/ziclix/python/sql/procedure/SQLServerProcedure.java trunk/jython/src/com/ziclix/python/sql/util/BCP.java trunk/jython/src/com/ziclix/python/sql/util/PyArgParser.java trunk/jython/src/com/ziclix/python/sql/util/Queue.java trunk/jython/src/com/ziclix/python/sql/util/QueueClosedException.java trunk/jython/src/com/ziclix/python/sql/zxJDBC.java Modified: trunk/jython/Lib/dbexts.py =================================================================== --- trunk/jython/Lib/dbexts.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/dbexts.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,5 +1,3 @@ -# $Id$ - """ This script provides platform independence by wrapping Python Database API 2.0 compatible drivers to allow seamless database Modified: trunk/jython/Lib/isql.py =================================================================== --- trunk/jython/Lib/isql.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/isql.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,5 +1,3 @@ -# $Id$ - import dbexts, cmd, sys, os """ Modified: trunk/jython/Lib/test/zxjdbc/dbextstest.py =================================================================== --- trunk/jython/Lib/test/zxjdbc/dbextstest.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/test/zxjdbc/dbextstest.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,8 +1,6 @@ # Jython Database Specification API 2.0 # -# $Id$ -# # Copyright (c) 2001 brian zimmer <bz...@zi...> import dbexts, runner, tempfile, os Modified: trunk/jython/Lib/test/zxjdbc/jndi.py =================================================================== --- trunk/jython/Lib/test/zxjdbc/jndi.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/test/zxjdbc/jndi.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,8 +1,5 @@ - # Jython Database Specification API 2.0 # -# $Id$ -# # Copyright (c) 2001 brian zimmer <bz...@zi...> """ Modified: trunk/jython/Lib/test/zxjdbc/runner.py =================================================================== --- trunk/jython/Lib/test/zxjdbc/runner.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/test/zxjdbc/runner.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,8 +1,5 @@ - # Jython Database Specification API 2.0 # -# $Id$ -# # Copyright (c) 2001 brian zimmer <bz...@zi...> """ Modified: trunk/jython/Lib/test/zxjdbc/sptest.py =================================================================== --- trunk/jython/Lib/test/zxjdbc/sptest.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/test/zxjdbc/sptest.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,8 +1,5 @@ - # Jython Database Specification API 2.0 # -# $Id$ -# # Copyright (c) 2001 brian zimmer <bz...@zi...> from zxtest import zxCoreTestCase Modified: trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py =================================================================== --- trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,4 @@ #!/usr/bin/env jython - -# $Id$ - """ This is to be used with the DB API compatibility test available @ http://stuartbishop.net/Software/DBAPI20TestSuite/ Modified: trunk/jython/Lib/test/zxjdbc/zxtest.py =================================================================== --- trunk/jython/Lib/test/zxjdbc/zxtest.py 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/Lib/test/zxjdbc/zxtest.py 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,8 +1,5 @@ - # Jython Database Specification API 2.0 # -# $Id$ -# # Copyright (c) 2001 brian zimmer <bz...@zi...> from com.ziclix.python.sql import zxJDBC Modified: trunk/jython/src/com/ziclix/python/sql/DBApiType.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/DBApiType.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/DBApiType.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -17,8 +16,6 @@ * a SQL datatype value. * * @author brian zimmer - * @author last modified by $Author$ - * @version $Revision$ */ public final class DBApiType extends PyInteger { Modified: trunk/jython/src/com/ziclix/python/sql/DataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/DataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/DataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -46,8 +45,6 @@ * CLOBs and Arrays. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class DataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/DateFactory.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/DateFactory.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/DateFactory.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2003 brian zimmer <bz...@zi...> * @@ -14,8 +13,6 @@ * Provide an extensible way to create dates for zxJDBC. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public interface DateFactory { Modified: trunk/jython/src/com/ziclix/python/sql/Fetch.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/Fetch.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/Fetch.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -48,7 +47,6 @@ * require the entire result set be presented as one.</p> * * @author brian zimmer - * @version $Revision$ */ abstract public class Fetch { Modified: trunk/jython/src/com/ziclix/python/sql/FilterDataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/FilterDataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/FilterDataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -25,8 +24,6 @@ * pass all requests to the contained data handler. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public abstract class FilterDataHandler extends DataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -29,8 +28,6 @@ * Support for JDBC 2.x type mappings, including Arrays, CLOBs and BLOBs. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class JDBC20DataHandler extends FilterDataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/JDBC30DataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/JDBC30DataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/JDBC30DataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2002 brian zimmer <bz...@zi...> * @@ -18,8 +17,6 @@ * Support for JDBC 3.x additions, notably ParameterMetaData. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class JDBC30DataHandler extends FilterDataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/JavaDateFactory.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/JavaDateFactory.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/JavaDateFactory.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2003 brian zimmer <bz...@zi...> * @@ -19,8 +18,6 @@ * Produce java.[util|sql] type dates. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class JavaDateFactory implements DateFactory { Modified: trunk/jython/src/com/ziclix/python/sql/Jython22DataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/Jython22DataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/Jython22DataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id: DataHandler.java 3708 2007-11-20 20:03:46Z pjenvey $ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -37,8 +36,6 @@ * objects for DATE, TIME and TIMESTAMP columns, instead of java.sql.* classes. * * @author brian zimmer - * @author last revised by $Author: pjenvey $ - * @version $Revision: 3708 $ */ public class Jython22DataHandler extends DataHandler { /** Modified: trunk/jython/src/com/ziclix/python/sql/Procedure.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/Procedure.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/Procedure.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -25,8 +24,6 @@ * the appropriate parameters. * * @author brian zimmer - * @author last modified by $Author$ - * @version $Revision$ */ public class Procedure extends Object { Modified: trunk/jython/src/com/ziclix/python/sql/PyConnection.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyConnection.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/PyConnection.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -33,8 +32,6 @@ * A connection to the database. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class PyConnection extends PyObject implements ClassDictInit, ContextManager { Modified: trunk/jython/src/com/ziclix/python/sql/PyCursor.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyCursor.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/PyCursor.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -35,8 +34,6 @@ * context of a fetch operation. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class PyCursor extends PyObject implements ClassDictInit, WarningListener, ContextManager { Modified: trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -22,8 +21,6 @@ * A cursor with extensions to the DB API 2.0. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class PyExtendedCursor extends PyCursor { /** Modified: trunk/jython/src/com/ziclix/python/sql/PyStatement.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyStatement.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/PyStatement.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -25,7 +24,6 @@ * Class PyStatement * * @author brian zimmer - * @version $Revision$ */ public class PyStatement extends PyObject { Modified: trunk/jython/src/com/ziclix/python/sql/WarningEvent.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/WarningEvent.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/WarningEvent.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * Modified: trunk/jython/src/com/ziclix/python/sql/WarningListener.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/WarningListener.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/WarningListener.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * Modified: trunk/jython/src/com/ziclix/python/sql/connect/Connect.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/connect/Connect.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/connect/Connect.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -19,8 +18,6 @@ * Connect using DriverManager. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class Connect extends PyObject { Modified: trunk/jython/src/com/ziclix/python/sql/connect/Connectx.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/connect/Connectx.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/connect/Connectx.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -29,8 +28,6 @@ * Connect using through a javax.sql.DataSource or javax.sql.ConnectionPooledDataSource. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class Connectx extends PyObject { Modified: trunk/jython/src/com/ziclix/python/sql/connect/Lookup.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/connect/Lookup.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/connect/Lookup.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -36,8 +35,6 @@ * <code>Connection</code> is established using the object. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class Lookup extends PyObject { Modified: trunk/jython/src/com/ziclix/python/sql/handler/InformixDataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/handler/InformixDataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/handler/InformixDataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -30,8 +29,6 @@ * Informix specific data handling. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class InformixDataHandler extends FilterDataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/handler/MySQLDataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -25,8 +24,6 @@ * MySQL specific data handling. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class MySQLDataHandler extends RowIdHandler { Modified: trunk/jython/src/com/ziclix/python/sql/handler/OracleDataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/handler/OracleDataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/handler/OracleDataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -32,8 +31,6 @@ * Oracle specific data handling. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class OracleDataHandler extends FilterDataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/handler/PostgresqlDataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/handler/PostgresqlDataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/handler/PostgresqlDataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * -* $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -24,8 +23,6 @@ * Postgresql specific data handling. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class PostgresqlDataHandler extends RowIdHandler { Modified: trunk/jython/src/com/ziclix/python/sql/handler/RowIdHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/handler/RowIdHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/handler/RowIdHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -24,8 +23,6 @@ * Handle the rowid methods since the API is not available until JDBC 3.0. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public abstract class RowIdHandler extends FilterDataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/handler/SQLServerDataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/handler/SQLServerDataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/handler/SQLServerDataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -24,8 +23,6 @@ * SQLServer specific data handling. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class SQLServerDataHandler extends FilterDataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/handler/UpdateCountDataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/handler/UpdateCountDataHandler.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/handler/UpdateCountDataHandler.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -27,8 +26,6 @@ * <code>0</code>.</p> * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ * @see java.sql.Statement#getUpdateCount() */ public class UpdateCountDataHandler extends FilterDataHandler { Modified: trunk/jython/src/com/ziclix/python/sql/pipe/Pipe.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/Pipe.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/Pipe.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -21,7 +20,6 @@ * or table to another. * * @author brian zimmer - * @version $Revision$ */ public class Pipe { @@ -104,10 +102,7 @@ * Class PipeRunner * * @author - * @author last modified by $Author$ - * @version $Revision$ * @date $today.date$ - * @date last modified on $Date$ * @copyright 2001 brian zimmer */ abstract class PipeRunner extends Thread { @@ -193,10 +188,7 @@ * Class SourceRunner * * @author - * @author last modified by $Author$ - * @version $Revision$ * @date $today.date$ - * @date last modified on $Date$ * @copyright 2001 brian zimmer */ class SourceRunner extends PipeRunner { @@ -250,10 +242,7 @@ * Class SinkRunner * * @author - * @author last modified by $Author$ - * @version $Revision$ * @date $today.date$ - * @date last modified on $Date$ * @copyright 2001 brian zimmer */ class SinkRunner extends PipeRunner { Modified: trunk/jython/src/com/ziclix/python/sql/pipe/Sink.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/Sink.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/Sink.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -15,7 +14,6 @@ * to the Sink as generated by the Source. * * @author brian zimmer - * @version $Revision$ */ public interface Sink { Modified: trunk/jython/src/com/ziclix/python/sql/pipe/Source.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/Source.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/Source.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -15,7 +14,6 @@ * from anywhere, but must follow the format detail in next(). * * @author brian zimmer - * @version $Revision$ * @see #next * @see Sink */ Modified: trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVSink.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVSink.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVSink.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -18,7 +17,6 @@ * The CSVSink writes data out in a Comma Seperated Format. * * @author brian zimmer - * @version $Revision$ */ public class CSVSink implements Sink { Modified: trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVString.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVString.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/csv/CSVString.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -12,7 +11,6 @@ * A utility class to aide in quoting CSV strings. * * @author brian zimmer - * @version $Revision$ */ public class CSVString { Modified: trunk/jython/src/com/ziclix/python/sql/pipe/db/BaseDB.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/db/BaseDB.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/db/BaseDB.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -20,7 +19,6 @@ * Abstract class to assist in generating cursors. * * @author brian zimmer - * @version $Revision$ */ public abstract class BaseDB { Modified: trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSink.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSink.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSink.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -24,7 +23,6 @@ * A database consumer. All data transferred will be inserted into the appropriate table. * * @author brian zimmer - * @version $Revision$ */ public class DBSink extends BaseDB implements Sink { Modified: trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSource.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSource.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/pipe/db/DBSource.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -18,7 +17,6 @@ * A database source. Given a PyConnection and information about the query, produce the data. * * @author brian zimmer - * @version $Revision$ */ public class DBSource extends BaseDB implements Source { Modified: trunk/jython/src/com/ziclix/python/sql/procedure/SQLServerProcedure.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/procedure/SQLServerProcedure.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/procedure/SQLServerProcedure.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2002 brian zimmer <mailto:bz...@zi...> * @@ -19,8 +18,6 @@ * Stored procedure support for SQLServer. * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class SQLServerProcedure extends Procedure { Modified: trunk/jython/src/com/ziclix/python/sql/util/BCP.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/util/BCP.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/util/BCP.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -188,9 +187,6 @@ } /** - * @author last modified by $Author$ - * @version $Revision$ - * @date last modified on $Date$ * @copyright 2001 brian zimmer */ class BCPFunc extends PyBuiltinMethodSet { Modified: trunk/jython/src/com/ziclix/python/sql/util/PyArgParser.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/util/PyArgParser.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/util/PyArgParser.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -18,7 +17,6 @@ * Parse the args and kws for a method call. * * @author brian zimmer - * @version $Revision$ */ public class PyArgParser extends Object { Modified: trunk/jython/src/com/ziclix/python/sql/util/Queue.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/util/Queue.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/util/Queue.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -16,7 +15,6 @@ * queue size under a certain threshold. * * @author brian zimmer - * @version $Revision$ */ public class Queue { Modified: trunk/jython/src/com/ziclix/python/sql/util/QueueClosedException.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/util/QueueClosedException.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/util/QueueClosedException.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -12,7 +11,6 @@ * This exception is thrown when the queue is closed and an operation is attempted. * * @author brian zimmer - * @version $Revision$ */ public class QueueClosedException extends RuntimeException { Modified: trunk/jython/src/com/ziclix/python/sql/zxJDBC.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/zxJDBC.java 2011-04-23 00:27:30 UTC (rev 7288) +++ trunk/jython/src/com/ziclix/python/sql/zxJDBC.java 2011-04-30 23:27:49 UTC (rev 7289) @@ -1,7 +1,6 @@ /* * Jython Database Specification API 2.0 * - * $Id$ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * @@ -41,8 +40,6 @@ * </pre> * * @author brian zimmer - * @author last revised by $Author$ - * @version $Revision$ */ public class zxJDBC extends PyObject implements ClassDictInit { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-05-01 00:13:54
|
Revision: 7292 http://jython.svn.sourceforge.net/jython/?rev=7292&view=rev Author: pjenvey Date: 2011-05-01 00:13:47 +0000 (Sun, 01 May 2011) Log Message: ----------- remove the remaining svn keywords Modified Paths: -------------- trunk/jython/Lib/dbexts.py trunk/jython/Lib/isql.py trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py trunk/jython/src/com/ziclix/python/sql/PyConnection.java trunk/jython/src/com/ziclix/python/sql/PyCursor.java trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java trunk/jython/src/com/ziclix/python/sql/PyStatement.java trunk/jython/src/com/ziclix/python/sql/util/BCP.java trunk/jython/src/com/ziclix/python/sql/zxJDBC.java trunk/jython/src/org/python/modules/cPickle.java Modified: trunk/jython/Lib/dbexts.py =================================================================== --- trunk/jython/Lib/dbexts.py 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/Lib/dbexts.py 2011-05-01 00:13:47 UTC (rev 7292) @@ -47,8 +47,6 @@ from types import StringType __author__ = "brian zimmer (bz...@zi...)" -__version__ = "$Revision$"[11:-2] - __OS__ = os.name choose = lambda bool, a, b: (bool and [a] or [b])[0] Modified: trunk/jython/Lib/isql.py =================================================================== --- trunk/jython/Lib/isql.py 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/Lib/isql.py 2011-05-01 00:13:47 UTC (rev 7292) @@ -5,8 +5,6 @@ for database work. """ -__version__ = "$Revision$"[11:-2] - class IsqlExit(Exception): pass class Prompt: Modified: trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py =================================================================== --- trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/Lib/test/zxjdbc/test_zxjdbc_dbapi20.py 2011-05-01 00:13:47 UTC (rev 7292) @@ -4,9 +4,6 @@ http://stuartbishop.net/Software/DBAPI20TestSuite/ """ -__rcs_id__ = '$Id$' -__version__ = '$Revision$' - import dbapi20 import unittest from com.ziclix.python.sql import zxJDBC as zxjdbc Modified: trunk/jython/src/com/ziclix/python/sql/PyConnection.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyConnection.java 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/src/com/ziclix/python/sql/PyConnection.java 2011-05-01 00:13:47 UTC (rev 7292) @@ -126,10 +126,6 @@ * @param dict */ static public void classDictInit(PyObject dict) { - PyObject version = - Py.newString("$Revision$").__getslice__(Py.newInteger(11), - Py.newInteger(-2)); - dict.__setitem__("__version__", version); dict.__setitem__("autocommit", new PyInteger(0)); dict.__setitem__("close", new ConnectionFunc("close", 0, 0, 0, zxJDBC.getString("close"))); dict.__setitem__("commit", new ConnectionFunc("commit", 1, 0, 0, Modified: trunk/jython/src/com/ziclix/python/sql/PyCursor.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyCursor.java 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/src/com/ziclix/python/sql/PyCursor.java 2011-05-01 00:13:47 UTC (rev 7292) @@ -243,10 +243,6 @@ * @param dict */ static public void classDictInit(PyObject dict) { - PyObject version = - Py.newString("$Revision$").__getslice__(Py.newInteger(11), - Py.newInteger(-2)); - dict.__setitem__("__version__", version); dict.__setitem__("fetchmany", new CursorFunc("fetchmany", 0, 0, 1, "fetch specified number of rows")); dict.__setitem__("close", new CursorFunc("close", 1, 0, "close the cursor")); dict.__setitem__("fetchall", new CursorFunc("fetchall", 2, 0, "fetch all results")); Modified: trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/src/com/ziclix/python/sql/PyExtendedCursor.java 2011-05-01 00:13:47 UTC (rev 7292) @@ -104,7 +104,6 @@ */ static public void classDictInit(PyObject dict) { PyCursor.classDictInit(dict); - dict.__setitem__("__version__", Py.newString("$Revision$").__getslice__(Py.newInteger(11), Py.newInteger(-2), null)); dict.__setitem__("tables", new ExtendedCursorFunc("tables", 100, 4, 4, "query for table information")); dict.__setitem__("columns", new ExtendedCursorFunc("columns", 101, 4, 4, "query for column information")); dict.__setitem__("primarykeys", new ExtendedCursorFunc("primarykeys", 102, 3, 3, "query for primary keys")); Modified: trunk/jython/src/com/ziclix/python/sql/PyStatement.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/PyStatement.java 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/src/com/ziclix/python/sql/PyStatement.java 2011-05-01 00:13:47 UTC (rev 7292) @@ -144,11 +144,6 @@ * @param dict */ static public void classDictInit(PyObject dict) { - PyObject version = - Py.newString("$Revision$").__getslice__(Py.newInteger(11), - Py.newInteger(-2)); - dict.__setitem__("__version__", version); - // hide from python dict.__setitem__("classDictInit", null); dict.__setitem__("statement", null); Modified: trunk/jython/src/com/ziclix/python/sql/util/BCP.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/util/BCP.java 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/src/com/ziclix/python/sql/util/BCP.java 2011-05-01 00:13:47 UTC (rev 7292) @@ -148,8 +148,6 @@ * @param dict */ static public void classDictInit(PyObject dict) { - - dict.__setitem__("__version__", Py.newString("$Revision$").__getslice__(Py.newInteger(11), Py.newInteger(-2), null)); dict.__setitem__("bcp", new BCPFunc("bcp", 0, 1, 2, zxJDBC.getString("bcp"))); dict.__setitem__("batchsize", Py.newString(zxJDBC.getString("batchsize"))); dict.__setitem__("queuesize", Py.newString(zxJDBC.getString("queuesize"))); Modified: trunk/jython/src/com/ziclix/python/sql/zxJDBC.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/zxJDBC.java 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/src/com/ziclix/python/sql/zxJDBC.java 2011-05-01 00:13:47 UTC (rev 7292) @@ -118,14 +118,9 @@ * @param dict */ public static void classDictInit(PyObject dict) { - PyObject version = - Py.newString("$Revision$").__getslice__(Py.newInteger(11), - Py.newInteger(-2)); - dict.__setitem__("apilevel", new PyString("2.0")); dict.__setitem__("threadsafety", new PyInteger(1)); dict.__setitem__("paramstyle", new PyString("qmark")); - dict.__setitem__("__version__", version); dict.__setitem__("Date", new zxJDBCFunc("Date", 1, 3, 3, "construct a Date from year, month, day")); dict.__setitem__("Time", new zxJDBCFunc("Time", 2, 3, 3, Modified: trunk/jython/src/org/python/modules/cPickle.java =================================================================== --- trunk/jython/src/org/python/modules/cPickle.java 2011-05-01 00:05:20 UTC (rev 7291) +++ trunk/jython/src/org/python/modules/cPickle.java 2011-05-01 00:13:47 UTC (rev 7292) @@ -350,11 +350,8 @@ * The doc string */ public static String __doc__ = - "Java implementation and optimization of the Python pickle module\n" + - "\n" + - "$Id$\n"; + "Java implementation and optimization of the Python pickle module\n"; - /** * The program version. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |