You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(107) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(76) |
Feb
(125) |
Mar
(72) |
Apr
(13) |
May
(18) |
Jun
(12) |
Jul
(129) |
Aug
(47) |
Sep
(1) |
Oct
(36) |
Nov
(128) |
Dec
(124) |
2002 |
Jan
(59) |
Feb
|
Mar
(14) |
Apr
(14) |
May
(72) |
Jun
(9) |
Jul
(3) |
Aug
(5) |
Sep
(18) |
Oct
(65) |
Nov
(28) |
Dec
(12) |
2003 |
Jan
(10) |
Feb
(2) |
Mar
(4) |
Apr
(33) |
May
(21) |
Jun
(9) |
Jul
(29) |
Aug
(34) |
Sep
(4) |
Oct
(8) |
Nov
(15) |
Dec
(4) |
2004 |
Jan
(26) |
Feb
(12) |
Mar
(11) |
Apr
(9) |
May
(7) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(2) |
Feb
(72) |
Mar
(16) |
Apr
(39) |
May
(48) |
Jun
(97) |
Jul
(57) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(100) |
Dec
(24) |
2006 |
Jan
(15) |
Feb
(34) |
Mar
(33) |
Apr
(31) |
May
(79) |
Jun
(64) |
Jul
(41) |
Aug
(64) |
Sep
(31) |
Oct
(46) |
Nov
(55) |
Dec
(37) |
2007 |
Jan
(32) |
Feb
(61) |
Mar
(11) |
Apr
(58) |
May
(46) |
Jun
(30) |
Jul
(94) |
Aug
(93) |
Sep
(86) |
Oct
(69) |
Nov
(125) |
Dec
(177) |
2008 |
Jan
(169) |
Feb
(97) |
Mar
(74) |
Apr
(113) |
May
(120) |
Jun
(334) |
Jul
(215) |
Aug
(237) |
Sep
(72) |
Oct
(189) |
Nov
(126) |
Dec
(160) |
2009 |
Jan
(180) |
Feb
(45) |
Mar
(98) |
Apr
(140) |
May
(151) |
Jun
(71) |
Jul
(107) |
Aug
(119) |
Sep
(73) |
Oct
(121) |
Nov
(14) |
Dec
(6) |
2010 |
Jan
(13) |
Feb
(9) |
Mar
(10) |
Apr
(64) |
May
(3) |
Jun
(16) |
Jul
(7) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(77) |
Apr
(11) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Finn B. <bc...@us...> - 2002-01-13 18:34:03
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv21988 Modified Files: PythonModule.py SimpleCompiler.py Log Message: Moved the Future instance to the module (part of pep-238 changes). Index: PythonModule.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonModule.py,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** PythonModule.py 2001/11/26 15:21:08 2.18 --- PythonModule.py 2002/01/13 18:33:59 2.19 *************** *** 10,13 **** --- 10,14 ---- from org.python.core.PyTableCode import CO_OPTIMIZED,CO_NESTED + from org.python.compiler import Future *************** *** 288,291 **** --- 289,293 ---- self.javaclasses = [] self.addjavaclass(self.name) + self.futures = Future() def getFrozen(self): Index: SimpleCompiler.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/SimpleCompiler.py,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** SimpleCompiler.py 2002/01/07 20:00:10 2.19 --- SimpleCompiler.py 2002/01/13 18:33:59 2.20 *************** *** 264,268 **** def getFutures(self): ! return self._futures def getFilename(self): --- 264,268 ---- def getFutures(self): ! return self.module.futures def getFilename(self): *************** *** 280,285 **** def parse(self, node): if isinstance(self.frame,GlobalFrame): ! futures = self._futures = Future() ! futures.preprocessFutures(node,None) ScopesCompiler(self).parse(node) self.frame.setScope(node.scope) --- 280,284 ---- def parse(self, node): if isinstance(self.frame,GlobalFrame): ! self.getFutures().preprocessFutures(node,None) ScopesCompiler(self).parse(node) self.frame.setScope(node.scope) |
From: Finn B. <bc...@us...> - 2002-01-13 18:31:59
|
Update of /cvsroot/jython/jython/org/python/compiler In directory usw-pr-cvs1:/tmp/cvs-serv21029 Modified Files: CodeCompiler.java Future.java Module.java ScopesCompiler.java Log Message: Support for floor division and future division. This patch also moves the Future instance from the CodeCompiler to the module where I believe it should be defined. I'm sorry if that happens to break something for nested_scope, but nested_scope should not need future support anymore. Index: CodeCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/CodeCompiler.java,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** CodeCompiler.java 2002/01/06 21:19:13 2.24 --- CodeCompiler.java 2002/01/13 18:31:55 2.25 *************** *** 38,46 **** public boolean fast_locals, print_results; - public Future futures; public Hashtable tbl; public ScopeInfo my_scope; ! public Future getFutures() { return futures; } public String getFilename() { return module.sfilename; } --- 38,45 ---- public boolean fast_locals, print_results; public Hashtable tbl; public ScopeInfo my_scope; ! public Future getFutures() { return module.futures; } public String getFilename() { return module.sfilename; } *************** *** 203,208 **** if (scope == null) { - futures = new Future(); - futures.preprocessFutures(node,cflags); new ScopesCompiler(this).parse(node); scope = node.scope; --- 202,205 ---- *************** *** 1409,1415 **** public Object div_2op(SimpleNode node) throws Exception { ! return binaryop(node, "_div"); } public Object mod_2op(SimpleNode node) throws Exception { return binaryop(node, "_mod"); --- 1406,1419 ---- public Object div_2op(SimpleNode node) throws Exception { ! if (getFutures().areDivisionOn()) ! return binaryop(node, "_truediv"); ! else ! return binaryop(node, "_div"); } + public Object floordiv_2op(SimpleNode node) throws Exception { + return binaryop(node, "_floordiv"); + } + public Object mod_2op(SimpleNode node) throws Exception { return binaryop(node, "_mod"); *************** *** 1470,1474 **** public Object aug_divide(SimpleNode node) throws Exception { ! return aug_binaryop(node, "__idiv__"); } --- 1474,1485 ---- public Object aug_divide(SimpleNode node) throws Exception { ! if (getFutures().areDivisionOn()) ! return aug_binaryop(node, "__itruediv__"); ! else ! return aug_binaryop(node, "__idiv__"); ! } ! ! public Object aug_floordivide(SimpleNode node) throws Exception { ! return aug_binaryop(node, "__ifloordiv__"); } Index: Future.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/Future.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -d -r2.5 -r2.6 *** Future.java 2001/11/27 19:07:21 2.5 --- Future.java 2002/01/13 18:31:55 2.6 *************** *** 8,11 **** --- 8,12 ---- private boolean nested_scopes; + private boolean division; private static final String FUTURE = "__future__"; *************** *** 38,41 **** --- 39,46 ---- continue; } + if (feature.equals("division")) { + division = true; + continue; + } throw new ParseException("future feature "+feature+ " is not defined",cand); *************** *** 50,55 **** if (cflags != null) { nested_scopes = cflags.nested_scopes; } - if ( node.id != JJTFILE_INPUT && node.id != JJTSINGLE_INPUT) return; --- 55,60 ---- if (cflags != null) { nested_scopes = cflags.nested_scopes; + division = cflags.division; } if ( node.id != JJTFILE_INPUT && node.id != JJTSINGLE_INPUT) return; *************** *** 71,74 **** --- 76,80 ---- if (cflags != null) { cflags.nested_scopes = cflags.nested_scopes || nested_scopes; + cflags.division = cflags.division || division; } } *************** *** 88,91 **** --- 94,101 ---- public boolean areNestedScopesOn() { return nested_scopes; + } + + public boolean areDivisionOn() { + return division; } Index: Module.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/Module.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** Module.java 2001/11/27 19:07:21 2.10 --- Module.java 2002/01/13 18:31:55 2.11 *************** *** 263,266 **** --- 263,267 ---- public boolean linenumbers; public boolean setFile=true; + Future futures; public Module(String name, String filename, boolean linenumbers) { *************** *** 275,278 **** --- 276,280 ---- this.filename = null; codes = new Vector(); + futures = new Future(); } *************** *** 582,585 **** --- 584,588 ---- Module module = new Module(name, filename, linenumbers); module.setFile = setFile; + module.futures.preprocessFutures(node, cflags); //Add __doc__ if it exists //Add __file__ for filename (if it exists?) Index: ScopesCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/ScopesCompiler.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -d -r2.5 -r2.6 *** ScopesCompiler.java 2001/11/27 19:07:21 2.5 --- ScopesCompiler.java 2002/01/13 18:31:55 2.6 *************** *** 399,402 **** --- 399,407 ---- } + public Object floordiv_2op(SimpleNode node) throws Exception { + binaryop(node); + return null; + } + public Object mod_2op(SimpleNode node) throws Exception { binaryop(node); *************** *** 624,627 **** --- 629,637 ---- public Object aug_divide(SimpleNode node) throws Exception { + aug_assign(node); + return null; + } + + public Object aug_floordivide(SimpleNode node) throws Exception { aug_assign(node); return null; |
From: Finn B. <bc...@us...> - 2002-01-13 18:26:54
|
Update of /cvsroot/jython/jython/org/python/parser In directory usw-pr-cvs1:/tmp/cvs-serv20545 Modified Files: PythonGrammar.java PythonGrammarConstants.java PythonGrammarTokenManager.java PythonGrammarTreeConstants.java Log Message: Generated files (floor division operator). Index: PythonGrammar.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/PythonGrammar.java,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** PythonGrammar.java 2001/12/20 17:19:03 2.15 --- PythonGrammar.java 2002/01/13 18:26:51 2.16 *************** *** 55,59 **** case TRIPLE_STRING: case TRIPLE_STRING2: ! case 113: simple_stmt(); break; --- 55,59 ---- case TRIPLE_STRING: case TRIPLE_STRING2: ! case 115: simple_stmt(); [...1432 lines suppressed...] --- 6816,6821 ---- final public ParseException generateParseException() { jj_expentries.removeAllElements(); ! boolean[] la1tokens = new boolean[116]; ! for (int i = 0; i < 116; i++) { la1tokens[i] = false; } *************** *** 6783,6787 **** } } ! for (int i = 0; i < 114; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; --- 6842,6846 ---- } } ! for (int i = 0; i < 116; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; Index: PythonGrammarConstants.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/PythonGrammarConstants.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -d -r2.7 -r2.8 *** PythonGrammarConstants.java 2001/10/30 20:37:33 2.7 --- PythonGrammarConstants.java 2002/01/13 18:26:51 2.8 *************** *** 30,101 **** int MULTIPLY = 30; int DIVIDE = 31; ! int POWER = 32; ! int LSHIFT = 33; ! int RSHIFT = 34; ! int MODULO = 35; ! int NOT = 36; ! int XOR = 37; ! int OR = 38; ! int AND = 39; ! int EQUAL = 40; ! int GREATER = 41; ! int LESS = 42; ! int EQEQUAL = 43; ! int EQLESS = 44; ! int EQGREATER = 45; ! int LESSGREATER = 46; ! int NOTEQUAL = 47; ! int PLUSEQ = 48; ! int MINUSEQ = 49; ! int MULTIPLYEQ = 50; ! int DIVIDEEQ = 51; ! int MODULOEQ = 52; ! int ANDEQ = 53; ! int OREQ = 54; ! int XOREQ = 55; ! int LSHIFTEQ = 56; ! int RSHIFTEQ = 57; ! int POWEREQ = 58; ! int OR_BOOL = 59; ! int AND_BOOL = 60; ! int NOT_BOOL = 61; ! int IS = 62; ! int IN = 63; ! int LAMBDA = 64; ! int IF = 65; ! int ELSE = 66; ! int ELIF = 67; ! int WHILE = 68; ! int FOR = 69; ! int TRY = 70; ! int EXCEPT = 71; ! int DEF = 72; ! int CLASS = 73; ! int FINALLY = 74; ! int PRINT = 75; ! int PASS = 76; ! int BREAK = 77; ! int CONTINUE = 78; ! int RETURN = 79; ! int IMPORT = 80; ! int FROM = 81; ! int DEL = 82; ! int RAISE = 83; ! int GLOBAL = 84; ! int EXEC = 85; ! int ASSERT = 86; ! int AS = 87; ! int NAME = 88; ! int LETTER = 89; ! int DECNUMBER = 90; ! int HEXNUMBER = 91; ! int OCTNUMBER = 92; ! int FLOAT = 93; ! int EXPONENT = 94; ! int DIGIT = 95; ! int SINGLE_STRING = 100; ! int SINGLE_STRING2 = 101; ! int TRIPLE_STRING = 102; ! int TRIPLE_STRING2 = 103; int DEFAULT = 0; --- 30,103 ---- int MULTIPLY = 30; int DIVIDE = 31; ! int FLOORDIVIDE = 32; ! int POWER = 33; ! int LSHIFT = 34; ! int RSHIFT = 35; ! int MODULO = 36; ! int NOT = 37; ! int XOR = 38; ! int OR = 39; ! int AND = 40; ! int EQUAL = 41; ! int GREATER = 42; ! int LESS = 43; ! int EQEQUAL = 44; ! int EQLESS = 45; ! int EQGREATER = 46; ! int LESSGREATER = 47; ! int NOTEQUAL = 48; ! int PLUSEQ = 49; ! int MINUSEQ = 50; ! int MULTIPLYEQ = 51; ! int DIVIDEEQ = 52; ! int FLOORDIVIDEEQ = 53; ! int MODULOEQ = 54; ! int ANDEQ = 55; ! int OREQ = 56; ! int XOREQ = 57; ! int LSHIFTEQ = 58; ! int RSHIFTEQ = 59; ! int POWEREQ = 60; ! int OR_BOOL = 61; ! int AND_BOOL = 62; ! int NOT_BOOL = 63; ! int IS = 64; ! int IN = 65; ! int LAMBDA = 66; ! int IF = 67; ! int ELSE = 68; ! int ELIF = 69; ! int WHILE = 70; ! int FOR = 71; ! int TRY = 72; ! int EXCEPT = 73; ! int DEF = 74; ! int CLASS = 75; ! int FINALLY = 76; ! int PRINT = 77; ! int PASS = 78; ! int BREAK = 79; ! int CONTINUE = 80; ! int RETURN = 81; ! int IMPORT = 82; ! int FROM = 83; ! int DEL = 84; ! int RAISE = 85; ! int GLOBAL = 86; ! int EXEC = 87; ! int ASSERT = 88; ! int AS = 89; ! int NAME = 90; ! int LETTER = 91; ! int DECNUMBER = 92; ! int HEXNUMBER = 93; ! int OCTNUMBER = 94; ! int FLOAT = 95; ! int EXPONENT = 96; ! int DIGIT = 97; ! int SINGLE_STRING = 102; ! int SINGLE_STRING2 = 103; ! int TRIPLE_STRING = 104; ! int TRIPLE_STRING2 = 105; int DEFAULT = 0; *************** *** 144,147 **** --- 146,150 ---- "\"*\"", "\"/\"", + "\"//\"", "\"**\"", "\"<<\"", *************** *** 164,167 **** --- 167,171 ---- "\"*=\"", "\"/=\"", + "\"//=\"", "\"%=\"", "\"&=\"", *************** *** 208,215 **** "<EXPONENT>", "<DIGIT>", - "<token of kind 96>", - "<token of kind 97>", "<token of kind 98>", "<token of kind 99>", "\"\\\'\"", "\"\\\"\"", --- 212,219 ---- "<EXPONENT>", "<DIGIT>", "<token of kind 98>", "<token of kind 99>", + "<token of kind 100>", + "<token of kind 101>", "\"\\\'\"", "\"\\\"\"", *************** *** 217,228 **** "\"\\\"\\\"\\\"\"", "\"\\\\\\r\\n\"", - "<token of kind 105>", - "<token of kind 106>", "<token of kind 107>", "\"\\r\\n\"", "\"\\n\"", "\"\\r\"", ! "<token of kind 111>", ! "<token of kind 112>", "\"`\"", }; --- 221,232 ---- "\"\\\"\\\"\\\"\"", "\"\\\\\\r\\n\"", "<token of kind 107>", + "<token of kind 108>", + "<token of kind 109>", "\"\\r\\n\"", "\"\\n\"", "\"\\r\"", ! "<token of kind 113>", ! "<token of kind 114>", "\"`\"", }; Index: PythonGrammarTokenManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/PythonGrammarTokenManager.java,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** PythonGrammarTokenManager.java 2001/12/20 17:19:06 2.14 --- PythonGrammarTokenManager.java 2002/01/13 18:26:51 2.15 *************** *** 52,67 **** { case 0: ! if ((active1 & 0x8000000000L) != 0L) { ! jjmatchedKind = 111; return -1; } return -1; case 1: ! if ((active1 & 0x8000000000L) != 0L) [...2095 lines suppressed...] image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)))); --- 2937,2941 ---- matchedToken.image = image.toString(); break; ! case 104 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)))); *************** *** 2934,2938 **** matchedToken.image = image.toString(); break; ! case 103 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)))); --- 2944,2948 ---- matchedToken.image = image.toString(); break; ! case 105 : if (image == null) image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)))); Index: PythonGrammarTreeConstants.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/PythonGrammarTreeConstants.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -d -r2.7 -r2.8 *** PythonGrammarTreeConstants.java 2002/01/06 21:19:14 2.7 --- PythonGrammarTreeConstants.java 2002/01/13 18:26:51 2.8 *************** *** 20,104 **** public int JJTAUG_MULTIPLY = 13; public int JJTAUG_DIVIDE = 14; ! public int JJTAUG_MODULO = 15; ! public int JJTAUG_AND = 16; ! public int JJTAUG_OR = 17; ! public int JJTAUG_XOR = 18; ! public int JJTAUG_LSHIFT = 19; ! public int JJTAUG_RSHIFT = 20; ! public int JJTAUG_POWER = 21; ! public int JJTPRINT_STMT = 22; ! public int JJTPRINT_EXT = 23; ! public int JJTDEL_STMT = 24; ! public int JJTPASS_STMT = 25; ! public int JJTBREAK_STMT = 26; ! public int JJTCONTINUE_STMT = 27; ! public int JJTRETURN_STMT = 28; ! public int JJTRAISE_STMT = 29; ! public int JJTIMPORT = 30; ! public int JJTIMPORTFROM = 31; ! public int JJTDOTTED_AS_NAME = 32; ! public int JJTDOTTED_NAME = 33; ! public int JJTIMPORT_AS_NAME = 34; ! public int JJTGLOBAL_STMT = 35; ! public int JJTEXEC_STMT = 36; ! public int JJTASSERT_STMT = 37; ! public int JJTIF_STMT = 38; ! public int JJTWHILE_STMT = 39; ! public int JJTFOR_STMT = 40; ! public int JJTTRY_STMT = 41; ! public int JJTEXCEPT_CLAUSE = 42; ! public int JJTSUITE = 43; ! public int JJTOR_BOOLEAN = 44; ! public int JJTAND_BOOLEAN = 45; ! public int JJTNOT_1OP = 46; ! public int JJTCOMPARISION = 47; ! public int JJTLESS_CMP = 48; ! public int JJTGREATER_CMP = 49; ! public int JJTEQUAL_CMP = 50; ! public int JJTGREATER_EQUAL_CMP = 51; ! public int JJTLESS_EQUAL_CMP = 52; ! public int JJTNOTEQUAL_CMP = 53; ! public int JJTIN_CMP = 54; ! public int JJTNOT_IN_CMP = 55; ! public int JJTIS_NOT_CMP = 56; ! public int JJTIS_CMP = 57; ! public int JJTOR_2OP = 58; ! public int JJTXOR_2OP = 59; ! public int JJTAND_2OP = 60; ! public int JJTLSHIFT_2OP = 61; ! public int JJTRSHIFT_2OP = 62; ! public int JJTADD_2OP = 63; ! public int JJTSUB_2OP = 64; ! public int JJTMUL_2OP = 65; ! public int JJTDIV_2OP = 66; ! public int JJTMOD_2OP = 67; ! public int JJTPOS_1OP = 68; ! public int JJTNEG_1OP = 69; ! public int JJTINVERT_1OP = 70; ! public int JJTPOW_2OP = 71; ! public int JJTCALL_OP = 72; ! public int JJTINDEX_OP = 73; ! public int JJTDOT_OP = 74; ! public int JJTTUPLE = 75; ! public int JJTLIST = 76; ! public int JJTDICTIONARY = 77; ! public int JJTSTR_1OP = 78; ! public int JJTSTRJOIN = 79; ! public int JJTLAMBDEF = 80; ! public int JJTELLIPSES = 81; ! public int JJTSLICE = 82; ! public int JJTCOLON = 83; ! public int JJTCOMMA = 84; ! public int JJTLIST_ITER = 85; ! public int JJTCLASSDEF = 86; ! public int JJTARGLIST = 87; ! public int JJTEXTRAARGVALUELIST = 88; ! public int JJTEXTRAKEYWORDVALUELIST = 89; ! public int JJTKEYWORD = 90; ! public int JJTINT = 91; ! public int JJTFLOAT = 92; ! public int JJTCOMPLEX = 93; ! public int JJTNAME = 94; ! public int JJTSTRING = 95; --- 20,106 ---- public int JJTAUG_MULTIPLY = 13; public int JJTAUG_DIVIDE = 14; ! public int JJTAUG_FLOORDIVIDE = 15; ! public int JJTAUG_MODULO = 16; ! public int JJTAUG_AND = 17; ! public int JJTAUG_OR = 18; ! public int JJTAUG_XOR = 19; ! public int JJTAUG_LSHIFT = 20; ! public int JJTAUG_RSHIFT = 21; ! public int JJTAUG_POWER = 22; ! public int JJTPRINT_STMT = 23; ! public int JJTPRINT_EXT = 24; ! public int JJTDEL_STMT = 25; ! public int JJTPASS_STMT = 26; ! public int JJTBREAK_STMT = 27; ! public int JJTCONTINUE_STMT = 28; ! public int JJTRETURN_STMT = 29; ! public int JJTRAISE_STMT = 30; ! public int JJTIMPORT = 31; ! public int JJTIMPORTFROM = 32; ! public int JJTDOTTED_AS_NAME = 33; ! public int JJTDOTTED_NAME = 34; ! public int JJTIMPORT_AS_NAME = 35; ! public int JJTGLOBAL_STMT = 36; ! public int JJTEXEC_STMT = 37; ! public int JJTASSERT_STMT = 38; ! public int JJTIF_STMT = 39; ! public int JJTWHILE_STMT = 40; ! public int JJTFOR_STMT = 41; ! public int JJTTRY_STMT = 42; ! public int JJTEXCEPT_CLAUSE = 43; ! public int JJTSUITE = 44; ! public int JJTOR_BOOLEAN = 45; ! public int JJTAND_BOOLEAN = 46; ! public int JJTNOT_1OP = 47; ! public int JJTCOMPARISION = 48; ! public int JJTLESS_CMP = 49; ! public int JJTGREATER_CMP = 50; ! public int JJTEQUAL_CMP = 51; ! public int JJTGREATER_EQUAL_CMP = 52; ! public int JJTLESS_EQUAL_CMP = 53; ! public int JJTNOTEQUAL_CMP = 54; ! public int JJTIN_CMP = 55; ! public int JJTNOT_IN_CMP = 56; ! public int JJTIS_NOT_CMP = 57; ! public int JJTIS_CMP = 58; ! public int JJTOR_2OP = 59; ! public int JJTXOR_2OP = 60; ! public int JJTAND_2OP = 61; ! public int JJTLSHIFT_2OP = 62; ! public int JJTRSHIFT_2OP = 63; ! public int JJTADD_2OP = 64; ! public int JJTSUB_2OP = 65; ! public int JJTMUL_2OP = 66; ! public int JJTDIV_2OP = 67; ! public int JJTFLOORDIV_2OP = 68; ! public int JJTMOD_2OP = 69; ! public int JJTPOS_1OP = 70; ! public int JJTNEG_1OP = 71; ! public int JJTINVERT_1OP = 72; ! public int JJTPOW_2OP = 73; ! public int JJTCALL_OP = 74; ! public int JJTINDEX_OP = 75; ! public int JJTDOT_OP = 76; ! public int JJTTUPLE = 77; ! public int JJTLIST = 78; ! public int JJTDICTIONARY = 79; ! public int JJTSTR_1OP = 80; ! public int JJTSTRJOIN = 81; ! public int JJTLAMBDEF = 82; ! public int JJTELLIPSES = 83; ! public int JJTSLICE = 84; ! public int JJTCOLON = 85; ! public int JJTCOMMA = 86; ! public int JJTLIST_ITER = 87; ! public int JJTCLASSDEF = 88; ! public int JJTARGLIST = 89; ! public int JJTEXTRAARGVALUELIST = 90; ! public int JJTEXTRAKEYWORDVALUELIST = 91; ! public int JJTKEYWORD = 92; ! public int JJTINT = 93; ! public int JJTFLOAT = 94; ! public int JJTCOMPLEX = 95; ! public int JJTNAME = 96; ! public int JJTSTRING = 97; *************** *** 119,122 **** --- 121,125 ---- "aug_multiply", "aug_divide", + "aug_floordivide", "aug_modulo", "aug_and", *************** *** 171,174 **** --- 174,178 ---- "mul_2op", "div_2op", + "floordiv_2op", "mod_2op", "pos_1op", |
From: Finn B. <bc...@us...> - 2002-01-13 18:23:10
|
Update of /cvsroot/jython/jython/org/python/parser In directory usw-pr-cvs1:/tmp/cvs-serv19953 Modified Files: Visitor.java SimpleNode.java Log Message: Support for the floor division operator (pep-238). Index: Visitor.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/Visitor.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -d -r2.5 -r2.6 *** Visitor.java 2001/10/28 17:13:44 2.5 --- Visitor.java 2002/01/13 18:23:08 2.6 *************** *** 215,218 **** --- 215,222 ---- } + public Object floordiv_2op(SimpleNode n) throws Exception { + throw new ParseException("Unhandled Node: "+n); + } + public Object mod_2op(SimpleNode n) throws Exception { throw new ParseException("Unhandled Node: "+n); *************** *** 340,343 **** --- 344,351 ---- public Object aug_divide(SimpleNode n) throws Exception { + throw new ParseException("Unhandled Node: "+n); + } + + public Object aug_floordivide(SimpleNode n) throws Exception { throw new ParseException("Unhandled Node: "+n); } Index: SimpleNode.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/SimpleNode.java,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** SimpleNode.java 2001/11/27 13:51:38 2.17 --- SimpleNode.java 2002/01/13 18:23:08 2.18 *************** *** 278,281 **** --- 278,283 ---- case PythonGrammarTreeConstants.JJTDIV_2OP: return visitor.div_2op(this); + case PythonGrammarTreeConstants.JJTFLOORDIV_2OP: + return visitor.floordiv_2op(this); case PythonGrammarTreeConstants.JJTMOD_2OP: return visitor.mod_2op(this); *************** *** 338,341 **** --- 340,345 ---- case PythonGrammarTreeConstants.JJTAUG_DIVIDE: return visitor.aug_divide(this); + case PythonGrammarTreeConstants.JJTAUG_FLOORDIVIDE: + return visitor.aug_floordivide(this); case PythonGrammarTreeConstants.JJTAUG_MODULO: return visitor.aug_modulo(this); |
From: Finn B. <bc...@us...> - 2002-01-13 18:22:09
|
Update of /cvsroot/jython/jython/org/python/parser In directory usw-pr-cvs1:/tmp/cvs-serv19651 Modified Files: python.jjt Log Message: Added floor division operator. Index: python.jjt =================================================================== RCS file: /cvsroot/jython/jython/org/python/parser/python.jjt,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** python.jjt 2001/12/20 17:15:01 2.17 --- python.jjt 2002/01/13 18:22:07 2.18 *************** *** 249,252 **** --- 249,253 ---- | < MULTIPLY: "*" > | < DIVIDE: "/" > + | < FLOORDIVIDE: "//" > | < POWER: "**" > | < LSHIFT: "<<" > *************** *** 269,272 **** --- 270,274 ---- | < MULTIPLYEQ: "*=" > | < DIVIDEEQ: "/=" > + | < FLOORDIVIDEEQ: "//=" > | < MODULOEQ: "%=" > | < ANDEQ: "&=" > *************** *** 476,479 **** --- 478,482 ---- | <MULTIPLYEQ> SmartTestList() #aug_multiply(2) | <DIVIDEEQ> SmartTestList() #aug_divide(2) + | <FLOORDIVIDEEQ> SmartTestList() #aug_floordivide(2) | <MODULOEQ> SmartTestList() #aug_modulo(2) | <ANDEQ> SmartTestList() #aug_and(2) *************** *** 661,664 **** --- 664,668 ---- factor() ( <MULTIPLY> factor() #mul_2op(2) | <DIVIDE> factor() #div_2op(2) + | <FLOORDIVIDE> factor() #floordiv_2op(2) | <MODULO> factor() #mod_2op(2) )* } |
From: Finn B. <bc...@us...> - 2002-01-13 18:21:27
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv19459 Modified Files: jython.java Log Message: Support the -Q option (pep-238). Index: jython.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/jython.java,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** jython.java 2001/12/07 13:48:56 2.24 --- jython.java 2002/01/13 18:21:24 2.25 *************** *** 22,25 **** --- 22,27 ---- "lineno)\n"+ "-E codec : Use a different codec the reading from the console.\n"+ + "-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, " + + "-Qnew\n"+ "file : program read from script file\n"+ "- : program read from stdin (default; interactive mode if a "+ *************** *** 145,148 **** --- 147,163 ---- } + if (opts.division != null) { + if ("old".equals(opts.division)) + Options.divisionWarning = 0; + else if ("warn".equals(opts.division)) + Options.divisionWarning = 1; + else if ("warnall".equals(opts.division)) + Options.divisionWarning = 2; + else if ("new".equals(opts.division)) { + Options.Qnew = true; + interp.cflags.division = true; + } + } + if (opts.command != null) { try { *************** *** 219,222 **** --- 234,238 ---- public java.util.Vector warnoptions = new java.util.Vector(); public String encoding; + public String division; public CommandLineOptions() { *************** *** 302,305 **** --- 318,327 ---- } setProperty(key, value); + } + else if (arg.startsWith("-Q")) { + if (arg.length() > 2) + division = arg.substring(2); + else + division = args[++index]; } else { |
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv18939 Modified Files: PyComplex.java PyFloat.java PyInstance.java PyInteger.java PyLong.java PyObject.java imp.java Log Message: Added __truediv__ and __floordiv__ methods. Emit warnings when classic __div__ is called. Index: PyComplex.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyComplex.java,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** PyComplex.java 2001/10/28 17:13:43 2.9 --- PyComplex.java 2002/01/13 18:20:31 2.10 *************** *** 178,181 **** --- 178,183 ---- if (!canCoerce(right)) return null; + if (Options.divisionWarning >= 2) + Py.warning(Py.DeprecationWarning, "classic complex division"); return _div(this, coerce(right)); } *************** *** 184,191 **** --- 186,218 ---- if (!canCoerce(left)) return null; + if (Options.divisionWarning >= 2) + Py.warning(Py.DeprecationWarning, "classic complex division"); return _div(coerce(left), this); } + public PyObject __floordiv__(PyObject right) { + if (!canCoerce(right)) + return null; + return _divmod(this, coerce(right)).__finditem__(0); + } + + public PyObject __rfloordiv__(PyObject left) { + if (!canCoerce(left)) + return null; + return _divmod(coerce(left), this).__finditem__(0); + } + public PyObject __truediv__(PyObject right) { + if (!canCoerce(right)) + return null; + return _div(this, coerce(right)); + } + + public PyObject __rtruediv__(PyObject left) { + if (!canCoerce(left)) + return null; + return _div(coerce(left), this); + } + public PyObject __mod__(PyObject right) { if (!canCoerce(right)) *************** *** 201,205 **** private static PyObject _mod(PyComplex value, PyComplex right) { ! PyComplex z = (PyComplex)value.__div__(right); z.real = Math.floor(z.real); --- 228,232 ---- private static PyObject _mod(PyComplex value, PyComplex right) { ! PyComplex z = (PyComplex) _div(value, right); z.real = Math.floor(z.real); *************** *** 222,226 **** private static PyObject _divmod(PyComplex value, PyComplex right) { ! PyComplex z = (PyComplex)value.__div__(right); z.real = Math.floor(z.real); --- 249,253 ---- private static PyObject _divmod(PyComplex value, PyComplex right) { ! PyComplex z = (PyComplex) _div(value, right); z.real = Math.floor(z.real); Index: PyFloat.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFloat.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** PyFloat.java 2001/10/28 17:13:43 2.10 --- PyFloat.java 2002/01/13 18:20:31 2.11 *************** *** 152,155 **** --- 152,157 ---- if (!canCoerce(right)) return null; + if (Options.divisionWarning >= 2) + Py.warning(Py.DeprecationWarning, "classic float division"); double rightv = coerce(right); if (rightv == 0) *************** *** 159,162 **** --- 161,202 ---- public PyObject __rdiv__(PyObject left) { + if (!canCoerce(left)) + return null; + if (Options.divisionWarning >= 2) + Py.warning(Py.DeprecationWarning, "classic float division"); + double leftv = coerce(left); + if (value == 0) + throw Py.ZeroDivisionError("float division"); + return new PyFloat(leftv / value); + } + + public PyObject __floordiv__(PyObject right) { + if (!canCoerce(right)) + return null; + double rightv = coerce(right); + if (rightv == 0) + throw Py.ZeroDivisionError("float division"); + return new PyFloat(Math.floor(value / rightv)); + } + + public PyObject __rfloordiv__(PyObject left) { + if (!canCoerce(left)) + return null; + double leftv = coerce(left); + if (value == 0) + throw Py.ZeroDivisionError("float division"); + return new PyFloat(Math.floor(leftv / value)); + } + + public PyObject __truediv__(PyObject right) { + if (!canCoerce(right)) + return null; + double rightv = coerce(right); + if (rightv == 0) + throw Py.ZeroDivisionError("float division"); + return new PyFloat(value / rightv); + } + + public PyObject __rtruediv__(PyObject left) { if (!canCoerce(left)) return null; Index: PyInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInstance.java,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** PyInstance.java 2002/01/07 20:07:53 2.30 --- PyInstance.java 2002/01/13 18:20:31 2.31 *************** *** 976,979 **** --- 976,1073 ---- /** + * Implements the __floordiv__ method by looking it up + * in the instance's dictionary and calling it if it is found. + **/ + public PyObject __floordiv__(PyObject o) { + Object ctmp = __coerce_ex__(o); + if (ctmp == null || ctmp == Py.None) + return invoke_ex("__floordiv__", o); + else { + PyObject o1 = ((PyObject[])ctmp)[0]; + PyObject o2 = ((PyObject[])ctmp)[1]; + if (this == o1) // Prevent recusion if __coerce__ return self + return invoke_ex("__floordiv__", o2); + else + return o1._floordiv(o2); + } + } + + /** + * Implements the __rfloordiv__ method by looking it up + * in the instance's dictionary and calling it if it is found. + **/ + public PyObject __rfloordiv__(PyObject o) { + Object ctmp = __coerce_ex__(o); + if (ctmp == null || ctmp == Py.None) + return invoke_ex("__rfloordiv__", o); + else { + PyObject o1 = ((PyObject[])ctmp)[0]; + PyObject o2 = ((PyObject[])ctmp)[1]; + if (this == o1) // Prevent recusion if __coerce__ return self + return invoke_ex("__rfloordiv__", o2); + else + return o2._floordiv(o1); + } + } + + /** + * Implements the __ifloordiv__ method by looking it up + * in the instance's dictionary and calling it if it is found. + **/ + public PyObject __ifloordiv__(PyObject o) { + PyObject ret = invoke_ex("__ifloordiv__", o); + if (ret != null) + return ret; + return super.__ifloordiv__(o); + } + + /** + * Implements the __truediv__ method by looking it up + * in the instance's dictionary and calling it if it is found. + **/ + public PyObject __truediv__(PyObject o) { + Object ctmp = __coerce_ex__(o); + if (ctmp == null || ctmp == Py.None) + return invoke_ex("__truediv__", o); + else { + PyObject o1 = ((PyObject[])ctmp)[0]; + PyObject o2 = ((PyObject[])ctmp)[1]; + if (this == o1) // Prevent recusion if __coerce__ return self + return invoke_ex("__truediv__", o2); + else + return o1._truediv(o2); + } + } + + /** + * Implements the __rtruediv__ method by looking it up + * in the instance's dictionary and calling it if it is found. + **/ + public PyObject __rtruediv__(PyObject o) { + Object ctmp = __coerce_ex__(o); + if (ctmp == null || ctmp == Py.None) + return invoke_ex("__rtruediv__", o); + else { + PyObject o1 = ((PyObject[])ctmp)[0]; + PyObject o2 = ((PyObject[])ctmp)[1]; + if (this == o1) // Prevent recusion if __coerce__ return self + return invoke_ex("__rtruediv__", o2); + else + return o2._truediv(o1); + } + } + + /** + * Implements the __itruediv__ method by looking it up + * in the instance's dictionary and calling it if it is found. + **/ + public PyObject __itruediv__(PyObject o) { + PyObject ret = invoke_ex("__itruediv__", o); + if (ret != null) + return ret; + return super.__itruediv__(o); + } + + /** * Implements the __mod__ method by looking it up * in the instance's dictionary and calling it if it is found. Index: PyInteger.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInteger.java,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** PyInteger.java 2001/10/28 17:13:43 2.13 --- PyInteger.java 2002/01/13 18:20:31 2.14 *************** *** 168,171 **** --- 168,173 ---- if (!canCoerce(right)) return null; + if (Options.divisionWarning > 0) + Py.warning(Py.DeprecationWarning, "classic int division"); return Py.newInteger(divide(value, coerce(right))); } *************** *** 174,178 **** --- 176,206 ---- if (!canCoerce(left)) return null; + if (Options.divisionWarning > 0) + Py.warning(Py.DeprecationWarning, "classic int division"); + return Py.newInteger(divide(coerce(left), value)); + } + + public PyObject __floordiv__(PyObject right) { + if (!canCoerce(right)) + return null; + return Py.newInteger(divide(value, coerce(right))); + } + + public PyObject __rfloordiv__(PyObject left) { + if (!canCoerce(left)) + return null; return Py.newInteger(divide(coerce(left), value)); + } + + public PyObject __truediv__(PyObject right) { + if (right instanceof PyInteger) + return __float__().__truediv__(right); + return null; + } + + public PyObject __rtruediv__(PyObject left) { + if (left instanceof PyInteger) + return left.__float__().__truediv__(this); + return null; } Index: PyLong.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyLong.java,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** PyLong.java 2001/10/28 17:13:43 2.13 --- PyLong.java 2002/01/13 18:20:31 2.14 *************** *** 189,192 **** --- 189,194 ---- if (!canCoerce(right)) return null; + if (Options.divisionWarning > 0) + Py.warning(Py.DeprecationWarning, "classic long division"); return new PyLong(divide(value, coerce(right))); } *************** *** 195,199 **** --- 197,227 ---- if (!canCoerce(left)) return null; + if (Options.divisionWarning > 0) + Py.warning(Py.DeprecationWarning, "classic long division"); + return new PyLong(divide(coerce(left), value)); + } + + public PyObject __floordiv__(PyObject right) { + if (!canCoerce(right)) + return null; + return new PyLong(divide(value, coerce(right))); + } + + public PyObject __rfloordiv__(PyObject left) { + if (!canCoerce(left)) + return null; return new PyLong(divide(coerce(left), value)); + } + + public PyObject __truediv__(PyObject right) { + if (!canCoerce(right)) + return null; + return new PyFloat(doubleValue() / coerce(right).doubleValue()); + } + + public PyObject __rtruediv__(PyObject left) { + if (!canCoerce(left)) + return null; + return new PyFloat(coerce(left).doubleValue() / doubleValue()); } Index: PyObject.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyObject.java,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** PyObject.java 2002/01/06 21:19:13 2.27 --- PyObject.java 2002/01/13 18:20:31 2.28 *************** *** 1609,1612 **** --- 1609,1614 ---- **/ public final PyObject _div(PyObject o2) { + if (Options.Qnew) + return _truediv(o2); PyObject x = __div__(o2); if (x != null) *************** *** 1617,1620 **** --- 1619,1712 ---- throw Py.TypeError( "__div__ nor __rdiv__ defined for these operands"); + } + + /** + * Equivalent to the standard Python __floordiv__ method + * @param other the object to perform this binary operation with + * (the right-hand operand). + * @return the result of the floordiv, or null if this operation + * is not defined + **/ + public PyObject __floordiv__(PyObject other) { return null; } + + /** + * Equivalent to the standard Python __rfloordiv__ method + * @param other the object to perform this binary operation with + * (the left-hand operand). + * @return the result of the floordiv, or null if this operation + * is not defined. + **/ + public PyObject __rfloordiv__(PyObject other) { return null; } + + /** + * Equivalent to the standard Python __ifloordiv__ method + * @param other the object to perform this binary operation with + * (the right-hand operand). + * @return the result of the floordiv, or null if this operation + * is not defined + **/ + public PyObject __ifloordiv__(PyObject other) { return _floordiv(other); } + + /** + * Implements the Python expression <code>this // other</code> + * @param other the object to perform this binary operation with. + * @return the result of the floordiv. + * @exception PyTypeError if this operation can't be performed + * with these operands. + **/ + public final PyObject _floordiv(PyObject o2) { + PyObject x = __floordiv__(o2); + if (x != null) + return x; + x = o2.__rfloordiv__(this); + if (x != null) + return x; + throw Py.TypeError( + "__floordiv__ nor __rfloordiv__ defined for these operands"); + } + + /** + * Equivalent to the standard Python __truediv__ method + * @param other the object to perform this binary operation with + * (the right-hand operand). + * @return the result of the truediv, or null if this operation + * is not defined + **/ + public PyObject __truediv__(PyObject other) { return null; } + + /** + * Equivalent to the standard Python __rtruediv__ method + * @param other the object to perform this binary operation with + * (the left-hand operand). + * @return the result of the truediv, or null if this operation + * is not defined. + **/ + public PyObject __rtruediv__(PyObject other) { return null; } + + /** + * Equivalent to the standard Python __itruediv__ method + * @param other the object to perform this binary operation with + * (the right-hand operand). + * @return the result of the truediv, or null if this operation + * is not defined + **/ + public PyObject __itruediv__(PyObject other) { return _truediv(other); } + + /** + * Implements the Python expression <code>this / other</code> + * @param other the object to perform this binary operation with. + * @return the result of the truediv. + * @exception PyTypeError if this operation can't be performed + * with these operands. + **/ + public final PyObject _truediv(PyObject o2) { + PyObject x = __truediv__(o2); + if (x != null) + return x; + x = o2.__rtruediv__(this); + if (x != null) + return x; + throw Py.TypeError( + "__truediv__ nor __rtruediv__ defined for these operands"); } Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** imp.java 2002/01/06 21:19:13 2.60 --- imp.java 2002/01/13 18:20:31 2.61 *************** *** 13,17 **** public class imp { ! public static final int APIVersion = 10; private imp() { ; } --- 13,17 ---- public class imp { ! public static final int APIVersion = 11; private imp() { ; } |
From: Finn B. <bc...@us...> - 2002-01-13 18:17:57
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv18623 Modified Files: PyTableCode.java Log Message: Added CO_FUTUREDIVISION. Value must match the value in __future__.py. Index: PyTableCode.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyTableCode.java,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** PyTableCode.java 2001/11/27 19:07:21 2.18 --- PyTableCode.java 2002/01/13 18:17:55 2.19 *************** *** 23,31 **** int func_id; ! final public static int CO_OPTIMIZED = 0x0001; ! //final public static int CO_NEWLOCALS = 0x0002 ! final public static int CO_VARARGS = 0x0004; ! final public static int CO_VARKEYWORDS = 0x0008; ! final public static int CO_NESTED = 0x0010; --- 23,32 ---- int func_id; ! final public static int CO_OPTIMIZED = 0x0001; ! //final public static int CO_NEWLOCALS = 0x0002 ! final public static int CO_VARARGS = 0x0004; ! final public static int CO_VARKEYWORDS = 0x0008; ! final public static int CO_NESTED = 0x0010; ! final public static int CO_FUTUREDIVISION = 0x2000; |
From: Finn B. <bc...@us...> - 2002-01-13 18:15:57
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv18101 Modified Files: CompilerFlags.java Log Message: Support for future division (pep-238). Index: CompilerFlags.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/CompilerFlags.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -d -r2.4 -r2.5 *** CompilerFlags.java 2001/11/27 19:07:21 2.4 --- CompilerFlags.java 2002/01/13 18:15:55 2.5 *************** *** 12,15 **** --- 12,16 ---- public boolean nested_scopes; + public boolean division; public String encoding; |
From: Finn B. <bc...@us...> - 2002-01-13 18:13:30
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv17807 Modified Files: Options.java Log Message: Two new options: Qnew and divisionWarning. In support for pep-238. Index: Options.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Options.java,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** Options.java 2002/01/11 10:18:33 2.11 --- Options.java 2002/01/13 18:13:28 2.12 *************** *** 82,85 **** --- 82,100 ---- public static boolean caseok = false; + /** + * If true, enable truedivision for the '/' operator. + */ + public static boolean Qnew = false; + + /** + * Enable division warning. The value maps to the registry values of + * <ul> + * <li>old: 0</li> + * <li>warn: 1</li> + * <li>warnall: 2</li> + * </ul> + */ + public static int divisionWarning = 0; + // // ####### END OF OPTIONS *************** *** 156,159 **** --- 171,189 ---- getBooleanOption("options.caseok", Options.caseok); + Options.Qnew = + getBooleanOption("options.Qnew", Options.Qnew); + + prop = PySystemState.registry.getProperty("python.divisionWarning"); + if (prop != null) { + if (prop.equalsIgnoreCase("old")) + Options.divisionWarning = 0; + else if (prop.equalsIgnoreCase("warn")) + Options.divisionWarning = 1; + else if (prop.equalsIgnoreCase("warnall")) + Options.divisionWarning = 2; + else + throw Py.ValueError("Illegal divisionWarning option " + + "setting: '"+ prop+"'"); + } // additional initializations which must happen after the registry // is guaranteed to be initialized. |
From: Finn B. <bc...@us...> - 2002-01-13 18:11:29
|
Update of /cvsroot/jython/jython/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17400 Modified Files: make_binops.py Log Message: Added __floordiv__ and __truediv__ (pep-238). Index: make_binops.py =================================================================== RCS file: /cvsroot/jython/jython/Misc/make_binops.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** make_binops.py 2001/02/04 14:51:47 1.4 --- make_binops.py 2002/01/13 18:11:27 1.5 *************** *** 3,6 **** --- 3,7 ---- binops = \ [('add', '+'), ('sub', '-'), ('mul', '*'), ('div', '/'), + ('floordiv', '//'), ('truediv', '/'), ('mod', '%'), ('divmod', 'divmod'), ('pow', '**'), ('lshift', '<<'), ('rshift', '>>'), ('and', '&'), ('or', '|'), ('xor', '^')] *************** *** 41,45 **** * with these operands. **/ ! public final PyObject _%(name)s(PyObject o2) { PyObject x = __%(name)s__(o2); if (x != null) --- 42,46 ---- * with these operands. **/ ! public final PyObject _%(name)s(PyObject o2) {%(divhook)s PyObject x = __%(name)s__(o2); if (x != null) *************** *** 60,68 **** for name, op in binops: rfunction = function = 'return null;' if name == 'pow': function = 'return __pow__(other, null);' ! ! fp.write(template % {'name':name, 'op':op, 'function':function, 'rfunction':rfunction}) fp.write(' // Generated by make_binops.py (End)\n\n') --- 61,80 ---- for name, op in binops: rfunction = function = 'return null;' + divhook = "" if name == 'pow': function = 'return __pow__(other, null);' ! if name == 'div': ! divhook = ''' ! if (Options.Qnew) ! return _truediv(o2);''' ! ! fp.write(template % { ! 'name':name, ! 'op':op, ! 'function':function, ! 'rfunction':rfunction, ! 'divhook':divhook ! }) fp.write(' // Generated by make_binops.py (End)\n\n') |
From: Finn B. <bc...@us...> - 2002-01-13 18:09:47
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv17156 Modified Files: NEWS Log Message: Added iterators. Index: NEWS =================================================================== RCS file: /cvsroot/jython/jython/NEWS,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** NEWS 2001/12/31 10:15:10 2.44 --- NEWS 2002/01/13 18:09:44 2.45 *************** *** 1,4 **** --- 1,11 ---- Jython NEWS + xx-xxx-2002 Jython 2.2 alpha1 + + New features + - Iterators (pep-234). + + Bug fixes. + 31-dec-2001 Jython 2.1 final |
From: brian z. <bz...@us...> - 2002-01-11 21:46:04
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/pipe/db In directory usw-pr-cvs1:/tmp/cvs-serv28812/ziclix/python/sql/pipe/db Modified Files: BaseDB.java DBSink.java Log Message: enable the throwing of all exceptions Index: BaseDB.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/pipe/db/BaseDB.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BaseDB.java 2001/11/20 04:55:18 1.1 --- BaseDB.java 2002/01/11 21:46:01 1.2 *************** *** 74,78 **** String msg = zxJDBC.getString("invalidCons", new Object[]{ this.dataHandler.getName() }); ! throw zxJDBC.newError(msg); } --- 74,78 ---- String msg = zxJDBC.getString("invalidCons", new Object[]{ this.dataHandler.getName() }); ! throw zxJDBC.makeException(msg); } Index: DBSink.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/pipe/db/DBSink.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DBSink.java 2001/11/20 04:55:18 1.1 --- DBSink.java 2002/01/11 21:46:01 1.2 *************** *** 91,95 **** // if there are no columns, what's the point? ! throw zxJDBC.newError(zxJDBC.getString("noColInfo")); } --- 91,95 ---- // if there are no columns, what's the point? ! throw zxJDBC.makeException(zxJDBC.getString("noColInfo")); } |
From: brian z. <bz...@us...> - 2002-01-11 21:46:04
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/pipe In directory usw-pr-cvs1:/tmp/cvs-serv28812/ziclix/python/sql/pipe Modified Files: Pipe.java Log Message: enable the throwing of all exceptions Index: Pipe.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/pipe/Pipe.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Pipe.java 2001/11/20 04:55:18 1.1 --- Pipe.java 2002/01/11 21:46:01 1.2 *************** *** 53,57 **** queue.close(); ! throw zxJDBC.newError(e); } --- 53,57 ---- queue.close(); ! throw zxJDBC.makeException(e); } *************** *** 61,65 **** queue.close(); ! throw zxJDBC.newError(e); } --- 61,65 ---- queue.close(); ! throw zxJDBC.makeException(e); } *************** *** 74,82 **** */ if (sourceRunner.threwException()) { ! throw zxJDBC.newError(sourceRunner.getException().toString()); } if (sinkRunner.threwException()) { ! throw zxJDBC.newError(sinkRunner.getException().toString()); } --- 74,82 ---- */ if (sourceRunner.threwException()) { ! throw zxJDBC.makeException(sourceRunner.getException().toString()); } if (sinkRunner.threwException()) { ! throw zxJDBC.makeException(sinkRunner.getException().toString()); } |
From: brian z. <bz...@us...> - 2002-01-11 21:46:04
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/connect In directory usw-pr-cvs1:/tmp/cvs-serv28812/ziclix/python/sql/connect Modified Files: Connect.java Connectx.java Lookup.java Log Message: enable the throwing of all exceptions Index: Connect.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/connect/Connect.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Connect.java 2001/11/20 04:55:18 1.1 --- Connect.java 2002/01/11 21:46:01 1.2 *************** *** 89,94 **** try { Class.forName(driver); ! } catch (ClassNotFoundException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, "driver not found"); } --- 89,94 ---- try { Class.forName(driver); ! } catch (Throwable e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, "driver [" + driver + "] not found"); } *************** *** 96,100 **** c = DriverManager.getConnection(url, props); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } else { --- 96,100 ---- c = DriverManager.getConnection(url, props); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } else { *************** *** 109,113 **** return new PyConnection(c); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } --- 109,113 ---- return new PyConnection(c); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } Index: Connectx.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/connect/Connectx.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Connectx.java 2001/11/20 04:55:18 1.1 --- Connectx.java 2002/01/11 21:46:01 1.2 *************** *** 107,111 **** } } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } --- 107,111 ---- } } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } *************** *** 117,121 **** pc = new PyConnection(c); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } --- 117,121 ---- pc = new PyConnection(c); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } *************** *** 152,163 **** if (method == null) { ! throw zxJDBC.newError("no such " + exceptionMsg); } method.invoke(src, new Object[]{ value }); } catch (IllegalAccessException e) { ! throw zxJDBC.newError("illegal access for " + exceptionMsg); } catch (InvocationTargetException e) { ! throw zxJDBC.newError("invocation target exception for " + exceptionMsg); } --- 152,163 ---- if (method == null) { ! throw zxJDBC.makeException("no such " + exceptionMsg); } method.invoke(src, new Object[]{ value }); } catch (IllegalAccessException e) { ! throw zxJDBC.makeException("illegal access for " + exceptionMsg); } catch (InvocationTargetException e) { ! throw zxJDBC.makeException("invocation target exception for " + exceptionMsg); } Index: Lookup.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/connect/Lookup.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Lookup.java 2001/11/20 04:55:18 1.1 --- Lookup.java 2002/01/11 21:46:01 1.2 *************** *** 89,93 **** fieldname = (String)field.get(Context.class); } catch (IllegalAccessException e) { ! throw zxJDBC.makeException(zxJDBC.ProgrammingError, e.getMessage()); } catch (NoSuchFieldException e) { fieldname = keyword; --- 89,93 ---- fieldname = (String)field.get(Context.class); } catch (IllegalAccessException e) { ! throw zxJDBC.makeException(zxJDBC.ProgrammingError, e); } catch (NoSuchFieldException e) { fieldname = keyword; *************** *** 103,107 **** ref = context.lookup((String)jndiName); } catch (NamingException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } finally { if (context != null) { --- 103,107 ---- ref = context.lookup((String)jndiName); } catch (NamingException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } finally { if (context != null) { *************** *** 127,131 **** } } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } --- 127,131 ---- } } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } *************** *** 137,141 **** return new PyConnection(connection); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } --- 137,141 ---- return new PyConnection(connection); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } |
From: brian z. <bz...@us...> - 2002-01-11 21:46:04
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv28812/ziclix/python/sql Modified Files: DataHandler.java Fetch.java PyConnection.java PyCursor.java PyExtendedCursor.java zxJDBC.java Log Message: enable the throwing of all exceptions Index: DataHandler.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/DataHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DataHandler.java 2001/12/29 07:16:20 1.5 --- DataHandler.java 2002/01/11 21:46:01 1.6 *************** *** 481,485 **** } } catch (IOException e) { ! throw zxJDBC.newError(e); } --- 481,485 ---- } } catch (IOException e) { ! throw zxJDBC.makeException(e); } *************** *** 508,512 **** } } catch (IOException e) { ! throw zxJDBC.newError(e); } --- 508,512 ---- } } catch (IOException e) { ! throw zxJDBC.makeException(e); } Index: Fetch.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/Fetch.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Fetch.java 2002/01/10 03:42:07 1.5 --- Fetch.java 2002/01/11 21:46:01 1.6 *************** *** 470,474 **** throw e; } catch (Exception e) { ! throw zxJDBC.newError(e); } finally { try { --- 470,474 ---- throw e; } catch (Exception e) { ! throw zxJDBC.makeException(e); } finally { try { *************** *** 504,508 **** throw e; } catch (Exception e) { ! throw zxJDBC.newError(e); } } --- 504,508 ---- throw e; } catch (Exception e) { ! throw zxJDBC.makeException(e); } } *************** *** 643,647 **** if (this.resultSet != null) { ! throw zxJDBC.newError(zxJDBC.getString("onlyOneResultSet")); } --- 643,647 ---- if (this.resultSet != null) { ! throw zxJDBC.makeException(zxJDBC.getString("onlyOneResultSet")); } *************** *** 658,662 **** throw e; } catch (Exception e) { ! throw zxJDBC.newError(e); } } --- 658,662 ---- throw e; } catch (Exception e) { ! throw zxJDBC.makeException(e); } } *************** *** 716,720 **** throw e; } catch (Exception e) { ! throw zxJDBC.newError(e); } --- 716,720 ---- throw e; } catch (Exception e) { ! throw zxJDBC.makeException(e); } Index: PyConnection.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyConnection.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyConnection.java 2001/12/12 17:19:45 1.4 --- PyConnection.java 2002/01/11 21:46:01 1.5 *************** *** 132,136 **** } } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } --- 132,136 ---- } } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } *************** *** 153,157 **** return connection.getAutoCommit() ? Py.One : Py.Zero; } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } else if ("dbname".equals(name)) { --- 153,157 ---- return connection.getAutoCommit() ? Py.One : Py.Zero; } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } else if ("dbname".equals(name)) { *************** *** 159,163 **** return Py.newString(this.connection.getMetaData().getDatabaseProductName()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } else if ("dbversion".equals(name)) { --- 159,163 ---- return Py.newString(this.connection.getMetaData().getDatabaseProductName()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } else if ("dbversion".equals(name)) { *************** *** 165,169 **** return Py.newString(this.connection.getMetaData().getDatabaseProductVersion()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } else if ("driverversion".equals(name)) { --- 165,169 ---- return Py.newString(this.connection.getMetaData().getDatabaseProductVersion()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } else if ("driverversion".equals(name)) { *************** *** 171,175 **** return Py.newString(this.connection.getMetaData().getDriverVersion()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } else if ("url".equals(name)) { --- 171,175 ---- return Py.newString(this.connection.getMetaData().getDriverVersion()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } else if ("url".equals(name)) { *************** *** 177,181 **** return Py.newString(this.connection.getMetaData().getURL()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e.getMessage()); } } else if ("__connection__".equals(name)) { --- 177,181 ---- return Py.newString(this.connection.getMetaData().getURL()); } catch (SQLException e) { ! throw zxJDBC.makeException(zxJDBC.DatabaseError, e); } } else if ("__connection__".equals(name)) { *************** *** 205,209 **** this.connection.close(); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 205,209 ---- this.connection.close(); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 227,231 **** this.connection.commit(); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 227,231 ---- this.connection.commit(); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 250,254 **** this.connection.rollback(); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 250,254 ---- this.connection.rollback(); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 274,278 **** return Py.newString(this.connection.nativeSQL(nativeSQL.__str__().toString())); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 274,278 ---- return Py.newString(this.connection.nativeSQL(nativeSQL.__str__().toString())); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PyCursor.java 2002/01/10 03:42:07 1.15 --- PyCursor.java 2002/01/11 21:46:01 1.16 *************** *** 408,412 **** throw e; } catch (Exception e) { ! throw zxJDBC.newError(e); } } --- 408,412 ---- throw e; } catch (Exception e) { ! throw zxJDBC.makeException(e); } } *************** *** 507,511 **** throw e; } catch (Exception e) { ! throw zxJDBC.newError(e); } } --- 507,511 ---- throw e; } catch (Exception e) { ! throw zxJDBC.makeException(e); } } Index: PyExtendedCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyExtendedCursor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyExtendedCursor.java 2002/01/10 03:42:07 1.8 --- PyExtendedCursor.java 2002/01/11 21:46:01 1.9 *************** *** 180,184 **** this.fetch.add(getMetaData().getTables(q, o, t, y)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 180,184 ---- this.fetch.add(getMetaData().getTables(q, o, t, y)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 204,208 **** this.fetch.add(getMetaData().getColumns(q, o, t, c)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 204,208 ---- this.fetch.add(getMetaData().getColumns(q, o, t, c)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 226,230 **** this.fetch.add(getMetaData().getProcedures(q, o, p)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 226,230 ---- this.fetch.add(getMetaData().getProcedures(q, o, p)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 250,254 **** this.fetch.add(getMetaData().getProcedureColumns(q, o, p, c)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 250,254 ---- this.fetch.add(getMetaData().getProcedureColumns(q, o, p, c)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 273,277 **** this.fetch.add(getMetaData().getPrimaryKeys(q, o, t)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 273,277 ---- this.fetch.add(getMetaData().getPrimaryKeys(q, o, t)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 306,310 **** this.fetch.add(getMetaData().getCrossReference(pq, po, pt, fq, fo, ft)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 306,310 ---- this.fetch.add(getMetaData().getCrossReference(pq, po, pt, fq, fo, ft)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 337,341 **** this.fetch.add(getMetaData().getIndexInfo(q, o, t, u, a), skipCols); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 337,341 ---- this.fetch.add(getMetaData().getIndexInfo(q, o, t, u, a), skipCols); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 358,362 **** this.fetch.add(getMetaData().getTypeInfo(), skipCols); } catch (SQLException e) { ! throw zxJDBC.newError(e); } --- 358,362 ---- this.fetch.add(getMetaData().getTypeInfo(), skipCols); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } *************** *** 386,390 **** this.fetch.add(getMetaData().getTableTypes()); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 386,390 ---- this.fetch.add(getMetaData().getTableTypes()); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 411,415 **** this.fetch.add(getMetaData().getBestRowIdentifier(c, s, t, p, n)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 411,415 ---- this.fetch.add(getMetaData().getBestRowIdentifier(c, s, t, p, n)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } *************** *** 434,438 **** this.fetch.add(getMetaData().getVersionColumns(q, o, t)); } catch (SQLException e) { ! throw zxJDBC.newError(e); } } --- 434,438 ---- this.fetch.add(getMetaData().getVersionColumns(q, o, t)); } catch (SQLException e) { ! throw zxJDBC.makeException(e); } } Index: zxJDBC.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/zxJDBC.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** zxJDBC.java 2002/01/11 05:29:02 1.6 --- zxJDBC.java 2002/01/11 21:46:01 1.7 *************** *** 104,108 **** dict.__setitem__("buildClass", null); dict.__setitem__("createExceptionMessage", null); - dict.__setitem__("newError", null); dict.__setitem__("resourceBundle", null); dict.__setitem__("getString", null); --- 104,107 ---- *************** *** 150,154 **** } } catch (Throwable t) { ! throw newError(t); } --- 149,153 ---- } } catch (Throwable t) { ! throw makeException(t); } *************** *** 284,289 **** /** ! * Return a newly instantiated PyException. */ public static PyException makeException(PyObject type, String msg) { return Py.makeException(type, Py.newString((msg == null) ? "" : msg)); --- 283,295 ---- /** ! * Return a newly instantiated PyException of the type Error. */ + public static PyException makeException(String msg) { + return makeException(Error, msg); + } + + /** + * Return a newly instantiated PyException of the given type. + */ public static PyException makeException(PyObject type, String msg) { return Py.makeException(type, Py.newString((msg == null) ? "" : msg)); *************** *** 291,304 **** /** ! * Return a newly instantiated Error. */ ! public static PyException newError(String msg) { ! return zxJDBC.makeException(Error, msg); } /** ! * Return a newly instantiated Error. */ ! public static PyException newError(Throwable t) { if (Options.showJavaExceptions) { --- 297,310 ---- /** ! * Return a newly instantiated PyException of the type Error. */ ! public static PyException makeException(Throwable throwable) { ! return makeException(Error, throwable); } /** ! * Return a newly instantiated PyException of the given type. */ ! public static PyException makeException(PyObject type, Throwable t) { if (Options.showJavaExceptions) { *************** *** 338,344 **** } while (sqlException != null); ! return newError(buffer.toString()); } else { ! return newError(t.getMessage()); } } --- 344,350 ---- } while (sqlException != null); ! return makeException(type, buffer.toString()); } else { ! return makeException(type, t.getMessage()); } } |
From: brian z. <bz...@us...> - 2002-01-11 21:34:20
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv25860 Modified Files: build.xml Log Message: added executable jar capability to jython.jar Index: build.xml =================================================================== RCS file: /cvsroot/jython/jython/build.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** build.xml 2001/12/02 19:57:44 1.25 --- build.xml 2002/01/11 21:34:18 1.26 *************** *** 50,54 **** classname="java.lang.ref.WeakReference" /> ! <available property="servlet.present" classname="javax.servlet.Servlet" classpath="${servlet.jar}" --- 50,54 ---- classname="java.lang.ref.WeakReference" /> ! <available property="servlet.present" classname="javax.servlet.Servlet" classpath="${servlet.jar}" *************** *** 210,216 **** --- 210,224 ---- <target name="jar" depends="compile"> + <!-- + Some windows systems need the ${line.separator} or will report a + "Failed to load Main-Class manifest attribute" error + --> + <echo file="${outputDir}/mainClass.mf" + message="Main-Class: org.python.util.jython${line.separator}"/> <jar jarfile="jython.jar" basedir="${outputDir}" + manifest="${outputDir}/mainClass.mf" includes="**/*.class,**/ucnhash.dat,**/*.properties" /> + <delete file="${outputDir}/mainClass.mf"/> </target> |
From: Finn B. <bc...@us...> - 2002-01-11 10:18:36
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv17674 Modified Files: Options.java Log Message: Fix a copy&paste bug in default value for caseok. 2.1.1 bugfix candidate. Index: Options.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Options.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** Options.java 2001/11/27 13:51:37 2.10 --- Options.java 2002/01/11 10:18:33 2.11 *************** *** 154,158 **** Options.caseok = ! getBooleanOption("options.caseok", Options.pollStandardIn); // additional initializations which must happen after the registry --- 154,158 ---- Options.caseok = ! getBooleanOption("options.caseok", Options.caseok); // additional initializations which must happen after the registry |
From: brian z. <bz...@us...> - 2002-01-11 05:29:05
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv892/com/ziclix/python/sql Modified Files: zxJDBC.java Log Message: cleaner exception handling Index: zxJDBC.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/zxJDBC.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** zxJDBC.java 2002/01/11 04:22:15 1.5 --- zxJDBC.java 2002/01/11 05:29:02 1.6 *************** *** 303,319 **** if (Options.showJavaExceptions) { - StdoutWrapper stderr = Py.stderr; - - stderr.println("Java Traceback:"); - java.io.CharArrayWriter buf = new java.io.CharArrayWriter(); if (t instanceof PyException) { ! ((PyException)t).super__printStackTrace(new java.io.PrintWriter(buf)); } else { ! t.printStackTrace(new java.io.PrintWriter(buf)); } ! stderr.print(buf.toString()); } --- 303,318 ---- if (Options.showJavaExceptions) { java.io.CharArrayWriter buf = new java.io.CharArrayWriter(); + java.io.PrintWriter writer = new java.io.PrintWriter(buf); + + writer.println("Java Traceback:"); if (t instanceof PyException) { ! ((PyException)t).super__printStackTrace(writer); } else { ! t.printStackTrace(writer); } ! Py.stderr.print(buf.toString()); } *************** *** 321,354 **** return (PyException)t; } else if (t instanceof SQLException) { StringBuffer buffer = new StringBuffer(); - - createExceptionMessage((SQLException)t, buffer, 0); ! return newError(buffer.toString()); ! } else { ! return newError(t.getMessage()); ! } ! } ! /** ! * Create SQL exception messages ! * ! * @param SQLException exception ! * @param StringBuffer buffer ! * @param int level ! * ! */ ! protected static void createExceptionMessage(SQLException exception, StringBuffer buffer, int level) { ! buffer.append(exception.getMessage()); ! buffer.append(" [SQLCode: " + exception.getErrorCode() + "]"); ! if (exception.getSQLState() != null) { ! buffer.append(", [SQLState: " + exception.getSQLState() + "]"); ! } ! if (exception.getNextException() != null) { ! buffer.append(System.getProperty("line.separator")); ! createExceptionMessage(exception.getNextException(), buffer, level + 1); } } --- 320,344 ---- return (PyException)t; } else if (t instanceof SQLException) { + SQLException sqlException = (SQLException)t; StringBuffer buffer = new StringBuffer(); ! do { ! buffer.append(sqlException.getMessage()); ! buffer.append(" [SQLCode: " + sqlException.getErrorCode() + "]"); ! if (sqlException.getSQLState() != null) { ! buffer.append(", [SQLState: " + sqlException.getSQLState() + "]"); ! } ! sqlException = sqlException.getNextException(); ! if (sqlException != null) { ! buffer.append(System.getProperty("line.separator")); ! } ! } while (sqlException != null); ! return newError(buffer.toString()); ! } else { ! return newError(t.getMessage()); } } |
From: brian z. <bz...@us...> - 2002-01-11 04:22:18
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv20073/com/ziclix/python/sql Modified Files: zxJDBC.java Log Message: print the java stacktrace if requested Index: zxJDBC.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/zxJDBC.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** zxJDBC.java 2001/12/14 04:18:54 1.4 --- zxJDBC.java 2002/01/11 04:22:15 1.5 *************** *** 300,318 **** * Return a newly instantiated Error. */ ! public static PyException newError(Throwable e) { ! if (e instanceof PyException) { ! throw (PyException)e; } ! try { StringBuffer buffer = new StringBuffer(); ! createExceptionMessage((SQLException)e, buffer, 0); return newError(buffer.toString()); ! } catch (ClassCastException ex) {} ! ! return newError(e.getMessage()); } --- 300,332 ---- * Return a newly instantiated Error. */ ! public static PyException newError(Throwable t) { ! if (Options.showJavaExceptions) { ! StdoutWrapper stderr = Py.stderr; ! ! stderr.println("Java Traceback:"); ! ! java.io.CharArrayWriter buf = new java.io.CharArrayWriter(); ! ! if (t instanceof PyException) { ! ((PyException)t).super__printStackTrace(new java.io.PrintWriter(buf)); ! } else { ! t.printStackTrace(new java.io.PrintWriter(buf)); ! } ! ! stderr.print(buf.toString()); } ! if (t instanceof PyException) { ! return (PyException)t; ! } else if (t instanceof SQLException) { StringBuffer buffer = new StringBuffer(); ! createExceptionMessage((SQLException)t, buffer, 0); return newError(buffer.toString()); ! } else { ! return newError(t.getMessage()); ! } } |
From: Kevin J. B. <kev...@us...> - 2002-01-10 22:43:48
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20289 Modified Files: javaos.py Log Message: added OS/2 support (from Ype Kingma) Index: javaos.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/javaos.py,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** javaos.py 2002/01/07 12:00:49 2.13 --- javaos.py 2002/01/10 22:43:46 2.14 *************** *** 306,309 **** --- 306,310 ---- r"(Windows 2000)|(Windows XP)|(Windows CE)" ), ( "dos", r"(dos)|(Windows 95)|(Windows 98)|(Windows ME)" ), + ( "os2", r"(OS/2)" ), ( "mac", r"(mac)|(MacOS.*)|(Darwin)" ), ( "None", r"(None)" ), *************** *** 333,337 **** # override defaults based on _osType ! if _osType == "nt": _shellCmd = ["cmd", "/c"] _envCmd = "set" --- 334,338 ---- # override defaults based on _osType ! if (_osType == "nt") or (_osType == "os2"): _shellCmd = ["cmd", "/c"] _envCmd = "set" *************** *** 370,373 **** --- 371,375 ---- "Solaris": "posix", "Linux": "posix", + "OS/2": "os2", "None": "None" } |
From: brian z. <bz...@us...> - 2002-01-10 03:42:35
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv3844/Lib/test/zxjdbc Modified Files: dbextstest.py zxtest.py Log Message: more robust testing Index: dbextstest.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/dbextstest.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dbextstest.py 2001/12/29 07:16:55 1.2 --- dbextstest.py 2002/01/10 03:42:32 1.3 *************** *** 39,42 **** --- 39,45 ---- self.db = dbexts.dbexts(cfg=fp.name) self.db.verbose = 0 + for table in ("one", "two"): + try: self.db.raw("drop table %s" % (table)) + except: pass self.db.raw("create table one (a int, b int, c varchar(32))") self.db.raw("create table two (a int, b int, c varchar(32))") *************** *** 80,84 **** finally: self.db.commit(c) - c.close() if not failed: --- 83,86 ---- *************** *** 176,181 **** """testing dbexts.table(tabname)""" self.db.table("one") ! assert not self.db.results == None, "results were None" self.assertEquals(3, len(self.db.results)) def testOut(self): --- 178,188 ---- """testing dbexts.table(tabname)""" self.db.table("one") ! assert self.db.results is not None, "results were None" self.assertEquals(3, len(self.db.results)) + self.db.table() + found = 0 + for a in self.db.results: + if a[2].lower() in ("one", "two"): found += 1 + self.assertEquals(2, found) def testOut(self): Index: zxtest.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/zxtest.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** zxtest.py 2002/01/08 05:39:32 1.8 --- zxtest.py 2002/01/10 03:42:32 1.9 *************** *** 104,117 **** c = self.cursor() try: ! c.execute("select * from zxtesting") cnt = 0 for a in c: - assert a is not None, "row is None" self.assertEquals(3, len(a)) cnt += 1 self.assertEquals(7, cnt) c.execute("select * from zxtesting") finally: c.close() def testColumns(self): --- 104,163 ---- c = self.cursor() try: ! # first with a for loop cnt = 0 + c.execute("select * from zxtesting") for a in c: self.assertEquals(3, len(a)) cnt += 1 self.assertEquals(7, cnt) + # then with a while loop + cnt = 0 + c.execute("select * from zxtesting") + while 1: + try: + self.assertEquals(3, len(c.next())) + except StopIteration: + break + cnt += 1 + self.assertEquals(7, cnt) + finally: + c.close() + + def testClosingCursor(self): + """testing that a closed cursor throws an exception""" + c = self.cursor() + try: c.execute("select * from zxtesting") finally: c.close() + self.assertRaises(zxJDBC.InternalError, c.execute, ("select * from zxtesting",)) + + def testNativeSQL(self): + """testing the connection's ability to convert sql""" + sql = self.db.nativesql("select * from zxtesting where id = ?") + assert sql is not None + assert len(sql) > 0 + + def testTables(self): + """testing cursor.tables()""" + c = self.cursor() + try: + c.tables(None, None, None, None) + # let's look for zxtesting + found = 0 + while not found: + try: + found = "zxtesting" == c.next()[2].lower() + except StopIteration: + break + assert found, "expected to find 'zxtesting'" + c.tables(None, None, "zxtesting", None) + self.assertEquals(1, len(c.fetchall())) + c.tables(None, None, "zxtesting", ("TABLE",)) + self.assertEquals(1, len(c.fetchall())) + c.tables(None, None, "zxtesting", ("table",)) + self.assertEquals(1, len(c.fetchall())) + finally: + c.close() def testColumns(self): *************** *** 119,127 **** c = self.cursor() try: c.columns(None, None, "zxtesting", None) f = c.fetchall() ! assert c.rowcount == 3, "columns() failed to report correct number of columns, expected [3], got [%d]" % (c.rowcount) f.sort(lambda x, y: cmp(x[3], y[3])) ! assert "name" == f[1][3].lower(), "expected [name], got [%s]" % (f[1][3].lower()) finally: c.close() --- 165,196 ---- c = self.cursor() try: + # deliberately copied so as to produce useful line numbers + c.columns(None, None, "zxtesting", None) f = c.fetchall() ! self.assertEquals(3, c.rowcount) f.sort(lambda x, y: cmp(x[3], y[3])) ! self.assertEquals("name", f[1][3].lower()) ! ! # if the db engine handles mixed case, then don't ask about a different ! # case because it will fail ! if not self.db.__connection__.getMetaData().storesMixedCaseIdentifiers(): ! c.columns(None, None, "ZXTESTING", None) ! f = c.fetchall() ! self.assertEquals(3, c.rowcount) ! f.sort(lambda x, y: cmp(x[3], y[3])) ! self.assertEquals("name", f[1][3].lower()) ! finally: ! c.close() ! ! def testBestRow(self): ! """testing bestrow which finds the optimal set of columns that uniquely identify a row""" ! c = self.cursor() ! try: ! # we're really just testing that this doesn't blow up ! c.bestrow(None, None, "zxtesting") ! f = c.fetchall() ! if f is not None: # we might as well see that it worked ! self.assertEquals(1, len(f)) finally: c.close() *************** *** 228,232 **** os.remove(fp.name) ! def __calendar(self): c = Calendar.getInstance() c.setTime(JDate()) --- 297,301 ---- os.remove(fp.name) ! def calendar(self): c = Calendar.getInstance() c.setTime(JDate()) *************** *** 238,242 **** # Java uses milliseconds and Python uses seconds, so adjust the time accordingly # seeded with Java ! c = self.__calendar() o = zxJDBC.DateFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Date(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE)) --- 307,311 ---- # Java uses milliseconds and Python uses seconds, so adjust the time accordingly # seeded with Java ! c = self.calendar() o = zxJDBC.DateFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Date(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE)) *************** *** 256,260 **** # seeded with Java ! c = self.__calendar() o = zxJDBC.TimeFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Time(c.get(Calendar.HOUR), c.get(Calendar.MINUTE), c.get(Calendar.SECOND)) --- 325,329 ---- # seeded with Java ! c = self.calendar() o = zxJDBC.TimeFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Time(c.get(Calendar.HOUR), c.get(Calendar.MINUTE), c.get(Calendar.SECOND)) *************** *** 274,278 **** # seeded with Java ! c = self.__calendar() o = zxJDBC.TimestampFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Timestamp(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE), --- 343,347 ---- # seeded with Java ! c = self.calendar() o = zxJDBC.TimestampFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Timestamp(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE), *************** *** 617,621 **** class LOBTest(zxJDBCTestCase): ! def __blob(self, obj=0): assert self.has_table("blobtable"), "no blob table" tabname, sql = self.table("blobtable") --- 686,690 ---- class LOBTest(zxJDBCTestCase): ! def _test_blob(self, obj=0): assert self.has_table("blobtable"), "no blob table" tabname, sql = self.table("blobtable") *************** *** 670,680 **** def testBLOBAsString(self): """testing BLOB as string""" ! self.__blob() def testBLOBAsPyFile(self): """testing BLOB as PyFile""" ! self.__blob(1) ! def __clob(self, asfile=0): assert self.has_table("clobtable"), "no clob table" tabname, sql = self.table("clobtable") --- 739,749 ---- def testBLOBAsString(self): """testing BLOB as string""" ! self._test_blob() def testBLOBAsPyFile(self): """testing BLOB as PyFile""" ! self._test_blob(1) ! def _test_clob(self, asfile=0): assert self.has_table("clobtable"), "no clob table" tabname, sql = self.table("clobtable") *************** *** 712,720 **** def testCLOBAsString(self): """testing CLOB as string""" ! self.__clob(0) def testCLOBAsPyFile(self): """testing CLOB as PyFile""" ! self.__clob(1) class BCPTestCase(zxJDBCTestCase): --- 781,789 ---- def testCLOBAsString(self): """testing CLOB as string""" ! self._test_clob(0) def testCLOBAsPyFile(self): """testing CLOB as PyFile""" ! self._test_clob(1) class BCPTestCase(zxJDBCTestCase): *************** *** 747,772 **** cnt = Pipe().pipe(dbSource, csvSink) - 1 # ignore the header row - - finally: - writer.close() - src.close() - os.remove(fn) - - def _testXMLPipe(self): - """testing the XML pipe""" - from java.io import PrintWriter, FileWriter - from com.ziclix.python.sql.pipe import Pipe - from com.ziclix.python.sql.pipe.db import DBSource - from com.ziclix.python.sql.pipe.xml import XMLSink - - try: - src = self.connect() - fn = tempfile.mktemp(suffix="csv") - writer = PrintWriter(FileWriter(fn)) - xmlSink = XMLSink(writer) - - dbSource = DBSource(src, c.datahandler.__class__, "zxtesting", None, None, None) - - cnt = Pipe().pipe(dbSource, xmlSink) - 1 # ignore the header row finally: --- 816,819 ---- |
From: brian z. <bz...@us...> - 2002-01-10 03:42:10
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv3743/com/ziclix/python/sql Modified Files: Fetch.java Procedure.java PyCursor.java PyExtendedCursor.java Log Message: documentation and some cleanup Index: Fetch.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/Fetch.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Fetch.java 2001/12/29 07:16:20 1.4 --- Fetch.java 2002/01/10 03:42:07 1.5 *************** *** 54,66 **** * */ ! public Fetch(PyCursor cursor) { this.cursor = cursor; this.description = Py.None; - this.rowcount = -1; } /** ! * Method newDynamicFetch * * @param PyCursor cursor --- 54,66 ---- * */ ! protected Fetch(PyCursor cursor) { + this.rowcount = -1; this.cursor = cursor; this.description = Py.None; } /** ! * Method newFetch * * @param PyCursor cursor *************** *** 69,86 **** * */ ! static Fetch newDynamicFetch(PyCursor cursor) { ! return new DynamicFetch(cursor); ! } ! /** ! * Method newStaticFetch ! * ! * @param PyCursor cursor ! * ! * @return Fetch ! * ! */ ! static Fetch newStaticFetch(PyCursor cursor) { ! return new StaticFetch(cursor); } --- 69,79 ---- * */ ! public static Fetch newFetch(PyCursor cursor) { ! if (cursor.dynamicFetch) { ! return new DynamicFetch(cursor); ! } else { ! return new StaticFetch(cursor); ! } } *************** *** 100,104 **** * * @param ResultSet resultSet ! * @param Set skipCols * */ --- 93,97 ---- * * @param ResultSet resultSet ! * @param Set skipCols JDBC-indexed set of columns to be skipped * */ Index: Procedure.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/Procedure.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Procedure.java 2002/01/07 02:11:19 1.5 --- Procedure.java 2002/01/10 03:42:07 1.6 *************** *** 15,19 **** /** ! * Class Procedure * * @author brian zimmer --- 15,21 ---- /** ! * This class provides the necessary functionality to call stored ! * procedures. It handles managing the database metadata and binding ! * the appropriate parameters. * * @author brian zimmer *************** *** 46,52 **** /** Field NULLABLE */ protected static final int NULLABLE = 11; - - /** Field PLACEHOLDER */ - public static final PyObject PLACEHOLDER = new PyObject(); /** Field cursor */ --- 48,51 ---- Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyCursor.java 2002/01/08 05:39:32 1.14 --- PyCursor.java 2002/01/10 03:42:07 1.15 *************** *** 27,30 **** --- 27,33 ---- public class PyCursor extends PyObject implements ClassDictInit { + /** Field closed */ + private boolean closed; + /** Field fetch */ protected Fetch fetch; *************** *** 80,83 **** --- 83,87 ---- this.arraysize = 1; + this.closed = false; this.connection = connection; this.datahandler = DATAHANDLER; *************** *** 108,112 **** static { ! PyObject[] m = new PyObject[7]; m[0] = new PyString("close"); --- 112,116 ---- static { ! PyObject[] m = new PyObject[8]; m[0] = new PyString("close"); *************** *** 117,120 **** --- 121,125 ---- m[5] = new PyString("fetchmany"); m[6] = new PyString("callproc"); + m[7] = new PyString("next"); __methods__ = new PyList(m); m = new PyObject[7]; *************** *** 215,219 **** dict.__setitem__("addWarning", null); dict.__setitem__("fetch", null); ! dict.__setitem__("newFetch", null); dict.__setitem__("sqlStatement", null); dict.__setitem__("dynamicFetch", null); --- 220,224 ---- dict.__setitem__("addWarning", null); dict.__setitem__("fetch", null); ! dict.__setitem__("closed", null); dict.__setitem__("sqlStatement", null); dict.__setitem__("dynamicFetch", null); *************** *** 253,257 **** --- 258,265 ---- */ public void close() { + this.clear(); + + this.closed = true; } *************** *** 282,286 **** if (row == null) { ! throw Py.StopIteration(null); } --- 290,294 ---- if (row == null) { ! throw Py.StopIteration(""); } *************** *** 298,306 **** PyObject row = fetchone(); ! if (row == Py.None) { ! row = null; ! } ! ! return row; } --- 306,310 ---- PyObject row = fetchone(); ! return (row == Py.None) ? null : row; } *************** *** 323,339 **** /** - * Method newFetch - * - */ - protected void newFetch() { - - if (this.dynamicFetch) { - this.fetch = Fetch.newDynamicFetch(this); - } else { - this.fetch = Fetch.newStaticFetch(this); - } - } - - /** * Prepare a statement ready for executing. * --- 327,330 ---- *************** *** 704,711 **** /** ! * Reset the cursor state. */ protected void clear() { this.warnings = Py.None; this.lastrowid = Py.None; --- 695,708 ---- /** ! * Resets the cursor state. This includes flushing the warnings ! * and any previous results. ! * */ protected void clear() { + if (closed) { + throw zxJDBC.makeException(zxJDBC.InternalError, "cursor is closed"); + } + this.warnings = Py.None; this.lastrowid = Py.None; *************** *** 716,720 **** } catch (Exception e) {} finally { ! this.newFetch(); } --- 713,717 ---- } catch (Exception e) {} finally { ! this.fetch = Fetch.newFetch(this); } Index: PyExtendedCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyExtendedCursor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyExtendedCursor.java 2001/12/21 21:00:56 1.7 --- PyExtendedCursor.java 2002/01/10 03:42:07 1.8 *************** *** 113,118 **** dict.__setitem__("gettypeinfo", new ExtendedCursorFunc("gettypeinfo", 107, 0, 1, "query for sql type info")); dict.__setitem__("gettabletypeinfo", new ExtendedCursorFunc("gettabletypeinfo", 108, 0, 1, "query for table types")); ! dict.__setitem__("bestrow", new ExtendedCursorFunc("bestrow", 109, 4, 4, "query for table types")); ! dict.__setitem__("versioncolumns", new ExtendedCursorFunc("versioncolumns", 110, 3, 3, "query for table types")); // hide from python --- 113,118 ---- dict.__setitem__("gettypeinfo", new ExtendedCursorFunc("gettypeinfo", 107, 0, 1, "query for sql type info")); dict.__setitem__("gettabletypeinfo", new ExtendedCursorFunc("gettabletypeinfo", 108, 0, 1, "query for table types")); ! dict.__setitem__("bestrow", new ExtendedCursorFunc("bestrow", 109, 3, 3, "optimal set of columns that uniquely identifies a row")); ! dict.__setitem__("versioncolumns", new ExtendedCursorFunc("versioncolumns", 110, 3, 3, "columns that are automatically updated when any value in a row is updated")); // hide from python *************** *** 157,161 **** --- 157,165 ---- String[] y = null; + // postgresql interprets the types to be uppercase exclusively + // so we'll force this on everyone else as well if (type != Py.None) { + String typeName = null; + if (isSeq(type)) { int len = type.__len__(); *************** *** 164,172 **** for (int i = 0; i < len; i++) { ! y[i] = getMetaDataName(type.__getitem__(i)); } } else { ! y = new String[1]; ! y[0] = getMetaDataName(type); } } --- 168,177 ---- for (int i = 0; i < len; i++) { ! typeName = getMetaDataName(type.__getitem__(i)); ! y[i] = (typeName == null) ? null : typeName.toUpperCase(); } } else { ! typeName = getMetaDataName(type.__getitem__(type)); ! y = new String[]{ (typeName == null) ? null : typeName.toUpperCase() }; } } *************** *** 400,404 **** String s = getMetaDataName(owner); String t = getMetaDataName(table); ! int p = DatabaseMetaData.bestRowUnknown; // scope boolean n = true; // nullable --- 405,409 ---- String s = getMetaDataName(owner); String t = getMetaDataName(table); ! int p = DatabaseMetaData.bestRowSession; // scope boolean n = true; // nullable *************** *** 451,457 **** // see if the driver can help us try { ! if (connection.connection.getMetaData().storesLowerCaseIdentifiers()) { return string.toLowerCase(); ! } else if (connection.connection.getMetaData().storesUpperCaseIdentifiers()) { return string.toUpperCase(); } --- 456,462 ---- // see if the driver can help us try { ! if (getMetaData().storesLowerCaseIdentifiers()) { return string.toLowerCase(); ! } else if (getMetaData().storesUpperCaseIdentifiers()) { return string.toUpperCase(); } |
From: brian z. <bz...@us...> - 2002-01-09 18:18:58
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23837/Lib Modified Files: isql.py Log Message: added __tojava__() to raw_input = 0 Index: isql.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/isql.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** isql.py 2002/01/07 05:00:12 1.2 --- isql.py 2002/01/09 18:18:55 1.3 *************** *** 1,5 **** # $Id$ ! import dbexts, cmd, sys """ --- 1,5 ---- # $Id$ ! import dbexts, cmd, sys, os """ *************** *** 27,30 **** --- 27,36 ---- prompt = "... " return prompt + if os.name == 'java': + def __tojava__(self, cls): + import java + if cls == java.lang.String: + return self.__str__() + return None class IsqlCmd(cmd.Cmd): |
From: brian z. <bz...@us...> - 2002-01-08 05:39:35
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv18246/com/ziclix/python/sql Modified Files: PyCursor.java Log Message: implemented iteration protocol Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyCursor.java 2002/01/07 02:59:00 1.13 --- PyCursor.java 2002/01/08 05:39:32 1.14 *************** *** 257,260 **** --- 257,309 ---- /** + * Returns an iteratable object. + * + * @return PyObject + * + * @since Jython 2.2, DB API 2.0+ + */ + public PyObject __iter__() { + return this; + } + + /** + * Returns the next row from the currently executing SQL statement + * using the same semantics as .fetchone(). A StopIteration + * exception is raised when the result set is exhausted for Python + * versions 2.2 and later. + * + * @return PyObject + * + * @since Jython 2.2, DB API 2.0+ + */ + public PyObject next() { + + PyObject row = __iternext__(); + + if (row == null) { + throw Py.StopIteration(null); + } + + return row; + } + + /** + * Return the next element of the sequence that this is an iterator + * for. Returns null when the end of the sequence is reached. + * + * @since Jython 2.2 + */ + public PyObject __iternext__() { + + PyObject row = fetchone(); + + if (row == Py.None) { + row = null; + } + + return row; + } + + /** * Return ths DatabaseMetaData for the current connection. * |