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: <pj...@us...> - 2009-10-26 06:38:53
|
Revision: 6904 http://jython.svn.sourceforge.net/jython/?rev=6904&view=rev Author: pjenvey Date: 2009-10-26 06:38:28 +0000 (Mon, 26 Oct 2009) Log Message: ----------- regen per r6903 Modified Paths: -------------- trunk/jython/src/org/python/antlr/ast/AssertDerived.java trunk/jython/src/org/python/antlr/ast/AssignDerived.java trunk/jython/src/org/python/antlr/ast/AttributeDerived.java trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java trunk/jython/src/org/python/antlr/ast/BinOpDerived.java trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java trunk/jython/src/org/python/antlr/ast/BreakDerived.java trunk/jython/src/org/python/antlr/ast/CallDerived.java trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java trunk/jython/src/org/python/antlr/ast/CompareDerived.java trunk/jython/src/org/python/antlr/ast/ContinueDerived.java trunk/jython/src/org/python/antlr/ast/DeleteDerived.java trunk/jython/src/org/python/antlr/ast/DictDerived.java trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java trunk/jython/src/org/python/antlr/ast/ExecDerived.java trunk/jython/src/org/python/antlr/ast/ExprDerived.java trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java trunk/jython/src/org/python/antlr/ast/ForDerived.java trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java trunk/jython/src/org/python/antlr/ast/GlobalDerived.java trunk/jython/src/org/python/antlr/ast/IfDerived.java trunk/jython/src/org/python/antlr/ast/IfExpDerived.java trunk/jython/src/org/python/antlr/ast/ImportDerived.java trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java trunk/jython/src/org/python/antlr/ast/IndexDerived.java trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java trunk/jython/src/org/python/antlr/ast/LambdaDerived.java trunk/jython/src/org/python/antlr/ast/ListCompDerived.java trunk/jython/src/org/python/antlr/ast/ListDerived.java trunk/jython/src/org/python/antlr/ast/ModuleDerived.java trunk/jython/src/org/python/antlr/ast/NameDerived.java trunk/jython/src/org/python/antlr/ast/NumDerived.java trunk/jython/src/org/python/antlr/ast/PassDerived.java trunk/jython/src/org/python/antlr/ast/PrintDerived.java trunk/jython/src/org/python/antlr/ast/RaiseDerived.java trunk/jython/src/org/python/antlr/ast/ReprDerived.java trunk/jython/src/org/python/antlr/ast/ReturnDerived.java trunk/jython/src/org/python/antlr/ast/SliceDerived.java trunk/jython/src/org/python/antlr/ast/StrDerived.java trunk/jython/src/org/python/antlr/ast/SubscriptDerived.java trunk/jython/src/org/python/antlr/ast/SuiteDerived.java trunk/jython/src/org/python/antlr/ast/TryExceptDerived.java trunk/jython/src/org/python/antlr/ast/TryFinallyDerived.java trunk/jython/src/org/python/antlr/ast/TupleDerived.java trunk/jython/src/org/python/antlr/ast/UnaryOpDerived.java trunk/jython/src/org/python/antlr/ast/WhileDerived.java trunk/jython/src/org/python/antlr/ast/WithDerived.java trunk/jython/src/org/python/antlr/ast/YieldDerived.java trunk/jython/src/org/python/antlr/ast/aliasDerived.java trunk/jython/src/org/python/antlr/ast/argumentsDerived.java trunk/jython/src/org/python/antlr/ast/comprehensionDerived.java trunk/jython/src/org/python/antlr/ast/keywordDerived.java trunk/jython/src/org/python/antlr/op/AddDerived.java trunk/jython/src/org/python/antlr/op/AndDerived.java trunk/jython/src/org/python/antlr/op/AugLoadDerived.java trunk/jython/src/org/python/antlr/op/AugStoreDerived.java trunk/jython/src/org/python/antlr/op/BitAndDerived.java trunk/jython/src/org/python/antlr/op/BitOrDerived.java trunk/jython/src/org/python/antlr/op/BitXorDerived.java trunk/jython/src/org/python/antlr/op/DelDerived.java trunk/jython/src/org/python/antlr/op/DivDerived.java trunk/jython/src/org/python/antlr/op/EqDerived.java trunk/jython/src/org/python/antlr/op/FloorDivDerived.java trunk/jython/src/org/python/antlr/op/GtDerived.java trunk/jython/src/org/python/antlr/op/GtEDerived.java trunk/jython/src/org/python/antlr/op/InDerived.java trunk/jython/src/org/python/antlr/op/InvertDerived.java trunk/jython/src/org/python/antlr/op/IsDerived.java trunk/jython/src/org/python/antlr/op/IsNotDerived.java trunk/jython/src/org/python/antlr/op/LShiftDerived.java trunk/jython/src/org/python/antlr/op/LoadDerived.java trunk/jython/src/org/python/antlr/op/LtDerived.java trunk/jython/src/org/python/antlr/op/LtEDerived.java trunk/jython/src/org/python/antlr/op/ModDerived.java trunk/jython/src/org/python/antlr/op/MultDerived.java trunk/jython/src/org/python/antlr/op/NotDerived.java trunk/jython/src/org/python/antlr/op/NotEqDerived.java trunk/jython/src/org/python/antlr/op/NotInDerived.java trunk/jython/src/org/python/antlr/op/OrDerived.java trunk/jython/src/org/python/antlr/op/ParamDerived.java trunk/jython/src/org/python/antlr/op/PowDerived.java trunk/jython/src/org/python/antlr/op/RShiftDerived.java trunk/jython/src/org/python/antlr/op/StoreDerived.java trunk/jython/src/org/python/antlr/op/SubDerived.java trunk/jython/src/org/python/antlr/op/UAddDerived.java trunk/jython/src/org/python/antlr/op/USubDerived.java trunk/jython/src/org/python/core/ClasspathPyImporterDerived.java trunk/jython/src/org/python/core/PyArrayDerived.java trunk/jython/src/org/python/core/PyBaseExceptionDerived.java trunk/jython/src/org/python/core/PyBooleanDerived.java trunk/jython/src/org/python/core/PyClassMethodDerived.java trunk/jython/src/org/python/core/PyComplexDerived.java trunk/jython/src/org/python/core/PyDictionaryDerived.java trunk/jython/src/org/python/core/PyEnumerateDerived.java trunk/jython/src/org/python/core/PyFileDerived.java trunk/jython/src/org/python/core/PyFloatDerived.java trunk/jython/src/org/python/core/PyFrozenSetDerived.java trunk/jython/src/org/python/core/PyIntegerDerived.java trunk/jython/src/org/python/core/PyListDerived.java trunk/jython/src/org/python/core/PyLongDerived.java trunk/jython/src/org/python/core/PyModuleDerived.java trunk/jython/src/org/python/core/PyObjectDerived.java trunk/jython/src/org/python/core/PyPropertyDerived.java trunk/jython/src/org/python/core/PySetDerived.java trunk/jython/src/org/python/core/PySliceDerived.java trunk/jython/src/org/python/core/PyStringDerived.java trunk/jython/src/org/python/core/PySuperDerived.java trunk/jython/src/org/python/core/PyTupleDerived.java trunk/jython/src/org/python/core/PyTypeDerived.java trunk/jython/src/org/python/core/PyUnicodeDerived.java trunk/jython/src/org/python/modules/_collections/PyDefaultDictDerived.java trunk/jython/src/org/python/modules/_collections/PyDequeDerived.java trunk/jython/src/org/python/modules/_csv/PyDialectDerived.java trunk/jython/src/org/python/modules/_functools/PyPartialDerived.java trunk/jython/src/org/python/modules/_weakref/ReferenceTypeDerived.java trunk/jython/src/org/python/modules/random/PyRandomDerived.java trunk/jython/src/org/python/modules/thread/PyLocalDerived.java trunk/jython/src/org/python/modules/zipimport/zipimporterDerived.java Modified: trunk/jython/src/org/python/antlr/ast/AssertDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AssertDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/AssertDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/AssignDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AssignDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/AssignDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/AttributeDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AttributeDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/AttributeDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/AugAssignDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/BinOpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BinOpDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/BinOpDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/BoolOpDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/BreakDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/BreakDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/BreakDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/CallDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/CallDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/CallDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ClassDefDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/CompareDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/CompareDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/CompareDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ContinueDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ContinueDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ContinueDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/DeleteDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/DeleteDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/DeleteDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/DictDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/DictDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/DictDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/EllipsisDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ExceptHandlerDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ExecDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExecDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ExecDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ExprDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExprDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ExprDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ExpressionDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ExtSliceDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ForDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ForDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ForDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/FunctionDefDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/GeneratorExpDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/GlobalDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/GlobalDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/GlobalDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/IfDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/IfDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/IfDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/IfExpDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/IfExpDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/IfExpDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ImportDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ImportDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ImportDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ImportFromDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/IndexDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/IndexDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/IndexDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/InteractiveDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/LambdaDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/LambdaDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/LambdaDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ListCompDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ListCompDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ListCompDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ListDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ListDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ListDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ModuleDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ModuleDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ModuleDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/NameDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/NameDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/NameDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/NumDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/NumDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/NumDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/PassDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/PassDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/PassDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/PrintDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/PrintDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/PrintDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/RaiseDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/RaiseDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/RaiseDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ReprDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ReprDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ReprDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/ReturnDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/ReturnDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/ReturnDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/SliceDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/SliceDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/SliceDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/StrDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/StrDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/StrDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/SubscriptDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/SubscriptDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/SubscriptDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/SuiteDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/SuiteDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/SuiteDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/TryExceptDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/TryExceptDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/TryExceptDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/TryFinallyDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/TryFinallyDerived.java 2009-10-26 06:36:47 UTC (rev 6903) +++ trunk/jython/src/org/python/antlr/ast/TryFinallyDerived.java 2009-10-26 06:38:28 UTC (rev 6904) @@ -1054,18 +1054,8 @@ return super.__pow__(other,modulo); } - public void dispatch__init__(PyType type,PyObject[]args,String[]keywords) { - PyType self_type=getType(); - if (self_type.isSubType(type)) { - PyObject impl=self_type.lookup("__init__"); - if (impl!=null) { - PyObject res=impl.__get__(this,self_type).__call__(args,keywords); - if (res!=Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'",res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[]args,String[]keywords) { + Deriveds.dispatch__init__(this,args,keywords); } public PyObject __index__() { Modified: trunk/jython/src/org/python/antlr/ast/TupleDerived.java =================================================================== --- trunk/jython/src/org/python/antlr/ast/TupleDerived.java 2009-10-26 06:36:47 UTC (r... [truncated message content] |
From: <pj...@us...> - 2009-10-26 06:37:03
|
Revision: 6903 http://jython.svn.sourceforge.net/jython/?rev=6903&view=rev Author: pjenvey Date: 2009-10-26 06:36:47 +0000 (Mon, 26 Oct 2009) Log Message: ----------- move Derived's dispatch__init__ guard into PyType and the rest of it into Deriveds Modified Paths: -------------- trunk/jython/src/org/python/core/Deriveds.java trunk/jython/src/org/python/core/PyObject.java trunk/jython/src/org/python/core/PyType.java trunk/jython/src/org/python/modules/thread/PyLocal.java trunk/jython/src/templates/object.derived Modified: trunk/jython/src/org/python/core/Deriveds.java =================================================================== --- trunk/jython/src/org/python/core/Deriveds.java 2009-10-26 04:16:36 UTC (rev 6902) +++ trunk/jython/src/org/python/core/Deriveds.java 2009-10-26 06:36:47 UTC (rev 6903) @@ -10,6 +10,20 @@ private static final PyObject objectGetattribute = PyObject.TYPE.__findattr__("__getattribute__"); + public static void dispatch__init__(PyObject self, PyObject[] args, String[] keywords) { + PyType type = self.getType(); + PyObject init = type.lookup("__init__"); + if (init == null) { + return; + } + PyObject result = init.__get__(self, type).__call__(args, keywords); + if (result != Py.None) { + throw Py.TypeError(String.format("__init__() should return None, not '%.200s'", + result.getType().fastGetName())); + } + self.proxyInit(); + } + /** * Deriveds' __findattr_ex__ implementation. * Modified: trunk/jython/src/org/python/core/PyObject.java =================================================================== --- trunk/jython/src/org/python/core/PyObject.java 2009-10-26 04:16:36 UTC (rev 6902) +++ trunk/jython/src/org/python/core/PyObject.java 2009-10-26 06:36:47 UTC (rev 6903) @@ -114,13 +114,14 @@ /** * Dispatch __init__ behavior */ - public void dispatch__init__(PyType type, PyObject[] args, String[] keywords) {} + public void dispatch__init__(PyObject[] args, String[] keywords) { + } /** * Attempts to automatically initialize our Java proxy if we have one and it wasn't initialized * by our __init__. */ - protected void proxyInit() { + void proxyInit() { Class<?> c = getType().getProxyType(); if (javaProxy != null || c == null) { return; Modified: trunk/jython/src/org/python/core/PyType.java =================================================================== --- trunk/jython/src/org/python/core/PyType.java 2009-10-26 04:16:36 UTC (rev 6902) +++ trunk/jython/src/org/python/core/PyType.java 2009-10-26 06:36:47 UTC (rev 6903) @@ -1477,11 +1477,13 @@ } PyObject obj = invokeNew(new_, this, true, args, keywords); - // special case type(x) - if (this == TYPE && args.length == 1 && keywords.length == 0) { + // When the call was type(something) or the returned object is not an instance of + // type, it won't be initialized + if ((this == TYPE && args.length == 1 && keywords.length == 0) + || !obj.getType().isSubType(this)) { return obj; } - obj.dispatch__init__(this, args, keywords); + obj.dispatch__init__(args, keywords); return obj; } Modified: trunk/jython/src/org/python/modules/thread/PyLocal.java =================================================================== --- trunk/jython/src/org/python/modules/thread/PyLocal.java 2009-10-26 04:16:36 UTC (rev 6902) +++ trunk/jython/src/org/python/modules/thread/PyLocal.java 2009-10-26 06:36:47 UTC (rev 6903) @@ -81,7 +81,7 @@ if (ldict == null) { ldict = new PyDictionary(); tdict.set(ldict); - dispatch__init__(getType(), args, keywords); + dispatch__init__(args, keywords); } return ldict; } Modified: trunk/jython/src/templates/object.derived =================================================================== --- trunk/jython/src/templates/object.derived 2009-10-26 04:16:36 UTC (rev 6902) +++ trunk/jython/src/templates/object.derived 2009-10-26 06:36:47 UTC (rev 6903) @@ -385,19 +385,8 @@ return super.__pow__(other, modulo); } - public void dispatch__init__(PyType type,PyObject[] args,String[] keywords) { - PyType self_type = getType(); - if (self_type.isSubType(type)) { - PyObject impl = self_type.lookup("__init__"); - if (impl != null) { - PyObject res = impl.__get__(this,self_type).__call__(args,keywords); - if (res != Py.None) { - throw Py.TypeError(String.format("__init__() should return None, not '%.200s'", - res.getType().fastGetName())); - } - proxyInit(); - } - } + public void dispatch__init__(PyObject[] args, String[] keywords) { + Deriveds.dispatch__init__(this, args, keywords); } public PyObject __index__() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-26 04:16:55
|
Revision: 6902 http://jython.svn.sourceforge.net/jython/?rev=6902&view=rev Author: pjenvey Date: 2009-10-26 04:16:36 +0000 (Mon, 26 Oct 2009) Log Message: ----------- fix handling of the corner case where the winning metatype differs from the specified type. we were calling the wrong __new__, and its __init__ twice Modified Paths: -------------- trunk/jython/Lib/test/test_class_jy.py trunk/jython/src/org/python/core/PyType.java Modified: trunk/jython/Lib/test/test_class_jy.py =================================================================== --- trunk/jython/Lib/test/test_class_jy.py 2009-10-25 18:31:36 UTC (rev 6901) +++ trunk/jython/Lib/test/test_class_jy.py 2009-10-26 04:16:36 UTC (rev 6902) @@ -190,7 +190,23 @@ raise IndexError, "Fraid not" self.assertRaises(IndexError, A().__getitem__, 'b') + def test_winning_metatype(self): + class Meta(type): + def __new__(cls, name, bases, attrs): + attrs['spam'] = name + attrs['counter'] = 0 + return type.__new__(cls, name, bases, attrs) + def __init__(cls, name, bases, attrs): + cls.counter += 1 + class Base(object): + __metaclass__ = Meta + Foo = type('Foo', (Base,), {}) + # Previously we called the wrong __new__ + self.assertEqual(Foo.spam, 'Foo') + # and called __init__ twice + self.assertEqual(Foo.counter, 1) + class ClassNamelessModuleTestCase(unittest.TestCase): def setUp(self): Modified: trunk/jython/src/org/python/core/PyType.java =================================================================== --- trunk/jython/src/org/python/core/PyType.java 2009-10-25 18:31:36 UTC (rev 6901) +++ trunk/jython/src/org/python/core/PyType.java 2009-10-26 04:16:36 UTC (rev 6902) @@ -144,11 +144,10 @@ PyType winner = findMostDerivedMetatype(tmpBases, metatype); if (winner != metatype) { - PyObject winner_new_ = winner.lookup("__new__"); - if (winner_new_ != null && winner_new_ != new_) { - return invoke_new_(new_, winner, false, - new PyObject[] {new PyString(name), bases, dict}, - Py.NoKeywords); + PyObject winnerNew = winner.lookup("__new__"); + if (winnerNew != null && winnerNew != new_) { + return invokeNew(winnerNew, winner, false, + new PyObject[] {new PyString(name), bases, dict}, Py.NoKeywords); } metatype = winner; } @@ -438,24 +437,19 @@ } } - private static PyObject invoke_new_(PyObject new_, PyType type, boolean init, PyObject[] args, - String[] keywords) { - PyObject newobj; + private static PyObject invokeNew(PyObject new_, PyType type, boolean init, PyObject[] args, + String[] keywords) { + PyObject obj; if (new_ instanceof PyNewWrapper) { - newobj = ((PyNewWrapper)new_).new_impl(init, type, args, keywords); + obj = ((PyNewWrapper)new_).new_impl(init, type, args, keywords); } else { int n = args.length; - PyObject[] type_prepended = new PyObject[n + 1]; - System.arraycopy(args, 0, type_prepended, 1, n); - type_prepended[0] = type; - newobj = new_.__get__(null, type).__call__(type_prepended, keywords); + PyObject[] typePrepended = new PyObject[n + 1]; + System.arraycopy(args, 0, typePrepended, 1, n); + typePrepended[0] = type; + obj = new_.__get__(null, type).__call__(typePrepended, keywords); } - // special case type(x) - if (type == TYPE && args.length == 1 && keywords.length == 0) { - return newobj; - } - newobj.dispatch__init__(type, args, keywords); - return newobj; + return obj; } /** @@ -1479,9 +1473,16 @@ final PyObject type___call__(PyObject[] args, String[] keywords) { PyObject new_ = lookup("__new__"); if (!instantiable || new_ == null) { - throw Py.TypeError("cannot create '" + name + "' instances"); + throw Py.TypeError(String.format("cannot create '%.100s' instances", name)); } - return invoke_new_(new_, this, true, args, keywords); + + PyObject obj = invokeNew(new_, this, true, args, keywords); + // special case type(x) + if (this == TYPE && args.length == 1 && keywords.length == 0) { + return obj; + } + obj.dispatch__init__(this, args, keywords); + return obj; } protected void __rawdir__(PyDictionary accum) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-25 18:31:56
|
Revision: 6901 http://jython.svn.sourceforge.net/jython/?rev=6901&view=rev Author: pjenvey Date: 2009-10-25 18:31:36 +0000 (Sun, 25 Oct 2009) Log Message: ----------- simplify indexFor Modified Paths: -------------- trunk/jython/src/org/python/core/PyType.java Modified: trunk/jython/src/org/python/core/PyType.java =================================================================== --- trunk/jython/src/org/python/core/PyType.java 2009-10-25 02:34:06 UTC (rev 6900) +++ trunk/jython/src/org/python/core/PyType.java 2009-10-25 18:31:36 UTC (rev 6901) @@ -1827,8 +1827,7 @@ * Return the table index for type version/name. */ private static int indexFor(Object version, String name) { - long hash = version.hashCode() * name.hashCode(); - return (int)hash >>> (Integer.SIZE - SIZE_EXP); + return (version.hashCode() * name.hashCode()) >>> (Integer.SIZE - SIZE_EXP); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-25 02:34:12
|
Revision: 6900 http://jython.svn.sourceforge.net/jython/?rev=6900&view=rev Author: fwierzbicki Date: 2009-10-25 02:34:06 +0000 (Sun, 25 Oct 2009) Log Message: ----------- switch MethodHandle creation to Codegen style. Modified Paths: -------------- branches/indy/src/org/python/compiler/Module.java Modified: branches/indy/src/org/python/compiler/Module.java =================================================================== --- branches/indy/src/org/python/compiler/Module.java 2009-10-24 07:19:01 UTC (rev 6899) +++ branches/indy/src/org/python/compiler/Module.java 2009-10-25 02:34:06 UTC (rev 6900) @@ -2,6 +2,9 @@ package org.python.compiler; import java.dyn.MethodHandle; +import java.dyn.MethodHandles; +import java.dyn.MethodHandles.Lookup; +import java.dyn.MethodType; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; @@ -358,19 +361,21 @@ } private void makeMethodHandle(Code c) { - c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodHandles", "lookup", "()Ljava/dyn/MethodHandles$Lookup;"); - c.visitLdcInsn(Type.getType("L"+module.classfile.name+";")); - c.visitLdcInsn(fname); - c.visitLdcInsn(Type.getType("Lorg/python/core/PyObject;")); - c.visitLdcInsn(Type.getType("Lorg/python/core/PyFrame;")); - c.visitInsn(ICONST_1); - c.visitTypeInsn(ANEWARRAY, "java/lang/Class"); - c.visitInsn(DUP); - c.visitInsn(ICONST_0); - c.visitLdcInsn(Type.getType("Lorg/python/core/ThreadState;")); - c.visitInsn(AASTORE); - c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodType", "make", "(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;"); - c.visitMethodInsn(INVOKEVIRTUAL, "java/dyn/MethodHandles$Lookup", "findVirtual", "(Ljava/lang/Class;Ljava/lang/String;Ljava/dyn/MethodType;)Ljava/dyn/MethodHandle;"); + c.invokestatic(p(MethodHandles.class), "lookup", sig(Lookup.class)); + c.ldc(Type.getType("L"+module.classfile.name+";")); + c.ldc(fname); + c.ldc(Type.getType(ci(PyObject.class))); + c.ldc(Type.getType(ci(PyFrame.class))); + c.iconst_1(); + c.anewarray(p(Class.class)); + c.dup(); + c.iconst_0(); + c.ldc(Type.getType(ci(ThreadState.class))); + c.aastore(); + c.invokestatic(p(MethodType.class), "make", + sig(MethodType.class, Class.class, Class.class, Class[].class)); + c.invokevirtual(p(Lookup.class), "findVirtual", + sig(MethodHandle.class, Class.class, String.class, MethodType.class)); } void put(Code c) throws IOException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-24 07:19:11
|
Revision: 6899 http://jython.svn.sourceforge.net/jython/?rev=6899&view=rev Author: pjenvey Date: 2009-10-24 07:19:01 +0000 (Sat, 24 Oct 2009) Log Message: ----------- migrate more over to PosixModule and more lazy imports in posix.py Modified Paths: -------------- trunk/jython/Lib/posix.py trunk/jython/src/org/python/core/Py.java trunk/jython/src/org/python/core/io/FileDescriptors.java trunk/jython/src/org/python/modules/posix/PosixModule.java Modified: trunk/jython/Lib/posix.py =================================================================== --- trunk/jython/Lib/posix.py 2009-10-24 05:46:34 UTC (rev 6898) +++ trunk/jython/Lib/posix.py 2009-10-24 07:19:01 UTC (rev 6899) @@ -11,19 +11,12 @@ import _nt as _posix from _nt import * import errno -import jarray -import stat as _stat import sys -from java.io import File -from org.python.core.io import FileDescriptors, IOBase -from org.python.core.Py import newString as asPyString __all__ = [name for name in _posix.__all__ if not name.startswith('__doc__')] -__all__.extend(['access', 'chdir', 'chmod', 'close', 'fdopen', 'fsync', - 'ftruncate', 'getcwd', 'getcwdu', 'getenv', 'getpid', 'isatty', - 'lseek', 'mkdir', 'popen', 'putenv', 'read', 'remove', - 'rename', 'rmdir', 'system', 'umask', 'unlink', 'unsetenv', - 'urandom', 'utime', 'write']) +__all__.extend(['chmod', 'fsync', 'getenv', 'getpid', 'isatty', 'mkdir', + 'popen', 'putenv', 'remove', 'rename', 'rmdir', 'system', + 'umask', 'unlink', 'unsetenv', 'urandom', 'utime']) _name = _posix.__name__[1:] @@ -33,36 +26,6 @@ # For urandom urandom_source = None -# Lazily loaded path module -_path = None - -def getcwd(): - """getcwd() -> path - - Return a string representing the current working directory. - """ - return asPyString(sys.getCurrentWorkingDir()) - -def getcwdu(): - """getcwd() -> path - - Return a unicode string representing the current working directory. - """ - return sys.getCurrentWorkingDir() - -def chdir(path): - """chdir(path) - - Change the current working directory to the specified path. - """ - global _path - if not _stat.S_ISDIR(stat(path).st_mode): - raise OSError(errno.ENOTDIR, strerror(errno.ENOTDIR), path) - if _path is None: - import os - _path = os.path - sys.setCurrentWorkingDir(_path.realpath(path)) - def chmod(path, mode): """chmod(path, mode) @@ -70,6 +33,7 @@ """ # XXX no error handling for chmod in jna-posix # catch not found errors explicitly here, for now + from java.io import File abs_path = sys.getPath(path) if not File(abs_path).exists(): raise OSError(errno.ENOENT, strerror(errno.ENOENT), path) @@ -83,6 +47,7 @@ The optional parameter is currently ignored. """ # XXX: use _posix_impl.mkdir when we can get the real errno upon failure + from java.io import File fp = File(sys.getPath(path)) if not fp.mkdir(): if fp.isDirectory() or fp.isFile(): @@ -97,6 +62,7 @@ Remove a file (same as unlink(path)). """ + from java.io import File if not File(sys.getPath(path)).delete(): raise OSError(0, "couldn't delete file", path) @@ -107,6 +73,7 @@ Rename a file or directory. """ + from java.io import File if not File(sys.getPath(path)).renameTo(File(sys.getPath(newpath))): raise OSError(0, "couldn't rename file", path) @@ -114,6 +81,7 @@ """rmdir(path) Remove a directory.""" + from java.io import File f = File(sys.getPath(path)) if not f.exists(): raise OSError(errno.ENOENT, strerror(errno.ENOENT), path) @@ -122,34 +90,6 @@ elif not f.delete(): raise OSError(0, "couldn't delete directory", path) -def access(path, mode): - """access(path, mode) -> True if granted, False otherwise - - Use the real uid/gid to test for access to a path. Note that most - operations will use the effective uid/gid, therefore this routine can - be used in a suid/sgid environment to test if the invoking user has the - specified access to the path. The mode argument can be F_OK to test - existence, or the inclusive-OR of R_OK, W_OK, and X_OK. - """ - if not isinstance(mode, (int, long)): - raise TypeError('an integer is required') - - f = File(sys.getPath(path)) - result = True - if not f.exists(): - result = False - if mode & R_OK and not f.canRead(): - result = False - if mode & W_OK and not f.canWrite(): - result = False - if mode & X_OK: - # NOTE: always False without jna-posix stat - try: - result = (stat(path).st_mode & _stat.S_IEXEC) != 0 - except OSError: - result = False - return result - def utime(path, times): """utime(path, (atime, mtime)) utime(path, None) @@ -201,78 +141,6 @@ usec = 0 return floor, usec -def close(fd): - """close(fd) - - Close a file descriptor (for low level IO). - """ - rawio = FileDescriptors.get(fd) - _handle_oserror(rawio.close) - -def fdopen(fd, mode='r', bufsize=-1): - """fdopen(fd [, mode='r' [, bufsize]]) -> file_object - - Return an open file object connected to a file descriptor. - """ - rawio = FileDescriptors.get(fd) - if (len(mode) and mode[0] or '') not in 'rwa': - raise ValueError("invalid file mode '%s'" % mode) - if rawio.closed(): - raise OSError(errno.EBADF, strerror(errno.EBADF)) - - try: - fp = FileDescriptors.wrap(rawio, mode, bufsize) - except IOError: - raise OSError(errno.EINVAL, strerror(errno.EINVAL)) - return fp - -def ftruncate(fd, length): - """ftruncate(fd, length) - - Truncate a file to a specified length. - """ - rawio = FileDescriptors.get(fd) - try: - rawio.truncate(length) - except Exception, e: - raise IOError(errno.EBADF, strerror(errno.EBADF)) - -def lseek(fd, pos, how): - """lseek(fd, pos, how) -> newpos - - Set the current position of a file descriptor. - """ - rawio = FileDescriptors.get(fd) - return _handle_oserror(rawio.seek, pos, how) - -def read(fd, buffersize): - """read(fd, buffersize) -> string - - Read a file descriptor. - """ - from org.python.core.util import StringUtil - rawio = FileDescriptors.get(fd) - buf = _handle_oserror(rawio.read, buffersize) - return asPyString(StringUtil.fromBytes(buf)) - -def write(fd, string): - """write(fd, string) -> byteswritten - - Write a string to a file descriptor. - """ - from java.nio import ByteBuffer - from org.python.core.util import StringUtil - rawio = FileDescriptors.get(fd) - return _handle_oserror(rawio.write, - ByteBuffer.wrap(StringUtil.toBytes(string))) - -def _handle_oserror(func, *args, **kwargs): - """Translate exceptions into OSErrors""" - try: - return func(*args, **kwargs) - except: - raise OSError(errno.EBADF, strerror(errno.EBADF)) - def system(command): """system(command) -> exit_status @@ -442,7 +310,7 @@ """wait() -> (pid, status) Wait for completion of a child process.""" - + import jarray status = jarray.zeros(1, 'i') res_pid = _posix_impl.wait(status) if res_pid == -1: @@ -453,6 +321,7 @@ """waitpid(pid, options) -> (pid, status) Wait for completion of a given child process.""" + import jarray status = jarray.zeros(1, 'i') res_pid = _posix_impl.waitpid(pid, status, options) if res_pid == -1: @@ -481,6 +350,7 @@ def _fsync(fd, metadata): """Internal fsync impl""" + from org.python.core.io import FileDescriptors rawio = FileDescriptors.get(fd) rawio.checkClosed() @@ -524,6 +394,7 @@ if isinstance(fileno, FileDescriptor): return _posix_impl.isatty(fileno) + from org.python.core.io import IOBase if not isinstance(fileno, IOBase): raise TypeError('a file descriptor is required') @@ -540,6 +411,7 @@ if urandom_source is None: from java.security import SecureRandom urandom_source = SecureRandom() + import jarray buffer = jarray.zeros(n, 'b') urandom_source.nextBytes(buffer) return buffer.tostring() Modified: trunk/jython/src/org/python/core/Py.java =================================================================== --- trunk/jython/src/org/python/core/Py.java 2009-10-24 05:46:34 UTC (rev 6898) +++ trunk/jython/src/org/python/core/Py.java 2009-10-24 07:19:01 UTC (rev 6899) @@ -108,6 +108,12 @@ return fromIOException(ioe, Py.OSError); } + public static PyException OSError(Constant errno) { + int value = errno.value(); + PyObject args = new PyTuple(Py.newInteger(value), PosixModule.strerror(value)); + return new PyException(Py.OSError, args); + } + public static PyException OSError(Constant errno, String filename) { int value = errno.value(); // Pass to strerror because constantine currently lacks Errno descriptions on Modified: trunk/jython/src/org/python/core/io/FileDescriptors.java =================================================================== --- trunk/jython/src/org/python/core/io/FileDescriptors.java 2009-10-24 05:46:34 UTC (rev 6898) +++ trunk/jython/src/org/python/core/io/FileDescriptors.java 2009-10-24 07:19:01 UTC (rev 6899) @@ -2,7 +2,6 @@ package org.python.core.io; import org.python.core.Py; -import org.python.core.PyFile; import org.python.core.PyObject; /** @@ -14,10 +13,6 @@ */ public class FileDescriptors { - public static PyFile wrap(RawIOBase raw, String mode, int bufsize) { - return new PyFile(raw, "<fdopen>", mode, bufsize); - } - /** * Return the RawIOBase associated with the specified file descriptor. * Modified: trunk/jython/src/org/python/modules/posix/PosixModule.java =================================================================== --- trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-24 05:46:34 UTC (rev 6898) +++ trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-24 07:19:01 UTC (rev 6899) @@ -8,6 +8,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; +import java.nio.ByteBuffer; import java.util.Map; import org.jruby.ext.posix.JavaPOSIX; @@ -17,12 +18,18 @@ import org.python.core.ClassDictInit; import org.python.core.Py; import org.python.core.PyDictionary; +import org.python.core.PyException; +import org.python.core.PyFile; import org.python.core.PyList; import org.python.core.PyObject; import org.python.core.PyString; import org.python.core.PyTuple; +import org.python.core.imp; +import org.python.core.io.FileDescriptors; import org.python.core.io.FileIO; +import org.python.core.io.RawIOBase; import org.python.core.util.RelativeFile; +import org.python.core.util.StringUtil; /** * The underlying _posix or _nt module, named depending on the platform. @@ -57,6 +64,15 @@ private static int O_TRUNC = 0x400; private static int O_EXCL = 0x800; + /** os.access constants. */ + private static int F_OK = 0; + private static int X_OK = 1 << 0; + private static int W_OK = 1 << 1; + private static int R_OK = 1 << 2; + + /** os.path.realpath function for use by chdir. Lazily loaded. */ + private static PyObject realpath; + public static void classDictInit(PyObject dict) { // only expose the open flags we support dict.__setitem__("O_RDONLY", Py.newInteger(O_RDONLY)); @@ -68,11 +84,10 @@ dict.__setitem__("O_TRUNC", Py.newInteger(O_TRUNC)); dict.__setitem__("O_EXCL", Py.newInteger(O_EXCL)); - // os.access constants - dict.__setitem__("F_OK", Py.Zero); - dict.__setitem__("X_OK", Py.newInteger(1 << 0)); - dict.__setitem__("W_OK", Py.newInteger(1 << 1)); - dict.__setitem__("R_OK", Py.newInteger(1 << 2)); + dict.__setitem__("F_OK", Py.newInteger(F_OK)); + dict.__setitem__("X_OK", Py.newInteger(X_OK)); + dict.__setitem__("W_OK", Py.newInteger(W_OK)); + dict.__setitem__("R_OK", Py.newInteger(R_OK)); // Successful termination dict.__setitem__("EX_OK", Py.Zero); @@ -86,6 +101,7 @@ dict.__setitem__("classDictInit", null); dict.__setitem__("getPOSIX", null); dict.__setitem__("getOSName", null); + dict.__setitem__("badFD", null); dict.__setitem__("__all__", dict.invoke("keys")); @@ -104,6 +120,129 @@ System.exit(status); } + public static PyString __doc__access = new PyString( + "access(path, mode) -> True if granted, False otherwise\n\n" + + "Use the real uid/gid to test for access to a path. Note that most\n" + + "operations will use the effective uid/gid, therefore this routine can\n" + + "be used in a suid/sgid environment to test if the invoking user has the\n" + + "specified access to the path. The mode argument can be F_OK to test\n" + + "existence, or the inclusive-OR of R_OK, W_OK, and X_OK."); + public static boolean access(String path, int mode) { + boolean result = true; + File file = new RelativeFile(path); + + if (!file.exists()) { + result = false; + } + if ((mode & R_OK) != 0 && !file.canRead()) { + result = false; + } + if ((mode & W_OK) != 0 && !file.canWrite()) { + result = false; + } + if ((mode & X_OK) != 0) { + // NOTE: always true without native jna-posix stat + try { + result = posix.stat(file.getPath()).isExecutable(); + } catch (PyException pye) { + if (!pye.match(Py.OSError)) { + throw pye; + } + // ENOENT + result = false; + } + } + return result; + } + + public static PyString __doc__chdir = new PyString( + "chdir(path)\n\n" + + "Change the current working directory to the specified path."); + public static void chdir(PyObject pathObj) { + if (!(pathObj instanceof PyString)) { + throw Py.TypeError(String.format("coercing to Unicode: need string, '%s' type found", + pathObj.getType().fastGetName())); + } + + String path = pathObj.toString(); + // stat raises ENOENT for us if path doesn't exist + if (!posix.stat(new RelativeFile(path).getPath()).isDirectory()) { + throw Py.OSError(Errno.ENOTDIR, path); + } + + if (realpath == null) { + realpath = imp.load("os.path").__getattr__("realpath"); + } + Py.getSystemState().setCurrentWorkingDir(realpath.__call__(pathObj).toString()); + } + + public static PyString __doc__close = new PyString( + "close(fd)\n\n" + + "Close a file descriptor (for low level IO)."); + public static void close(PyObject fd) { + try { + FileDescriptors.get(fd).close(); + } catch (PyException pye) { + badFD(); + } + } + + public static PyString __doc__fdopen = new PyString( + "fdopen(fd [, mode='r' [, bufsize]]) -> file_object\n\n" + + "Return an open file object connected to a file descriptor."); + public static PyObject fdopen(PyObject fd) { + return fdopen(fd, "r"); + + } + + public static PyObject fdopen(PyObject fd, String mode) { + return fdopen(fd, mode, -1); + + } + public static PyObject fdopen(PyObject fd, String mode, int bufsize) { + if (mode.length() == 0 || !"rwa".contains("" + mode.charAt(0))) { + throw Py.ValueError(String.format("invalid file mode '%s'", mode)); + } + RawIOBase rawIO = FileDescriptors.get(fd); + if (rawIO.closed()) { + badFD(); + } + + try { + return new PyFile(rawIO, "<fdopen>", mode, bufsize); + } catch (PyException pye) { + if (!pye.match(Py.IOError)) { + throw pye; + } + throw Py.OSError(Errno.EINVAL); + } + } + + public static PyString __doc__ftruncate = new PyString( + "ftruncate(fd, length)\n\n" + + "Truncate a file to a specified length."); + public static void ftruncate(PyObject fd, long length) { + try { + FileDescriptors.get(fd).truncate(length); + } catch (PyException pye) { + throw Py.IOError(Errno.EBADF); + } + } + + public static PyString __doc___getcwd = new PyString( + "getcwd() -> path\n\n" + + "Return a string representing the current working directory."); + public static PyObject getcwd() { + return Py.newString(Py.getSystemState().getCurrentWorkingDir()); + } + + public static PyString __doc___getcwdu = new PyString( + "getcwd() -> path\n\n" + + "Return a unicode string representing the current working directory."); + public static PyObject getcwdu() { + return Py.newUnicode(Py.getSystemState().getCurrentWorkingDir()); + } + public static PyString __doc__listdir = new PyString( "listdir(path) -> list_of_strings\n\n" + "Return a list containing the names of the entries in the directory.\n\n" + @@ -123,6 +262,18 @@ return list; } + public static PyString __doc__lseek = new PyString( + "lseek(fd, pos, how) -> newpos\n\n" + + "Set the current position of a file descriptor."); + public static long lseek(PyObject fd, long pos, int how) { + try { + return FileDescriptors.get(fd).seek(pos, how); + } catch (PyException pye) { + badFD(); + return -1; + } + } + public static PyString __doc__lstat = new PyString( "lstat(path) -> stat result\n\n" + "Like stat(path), but do not follow symbolic links."); @@ -134,11 +285,11 @@ "open(filename, flag [, mode=0777]) -> fd\n\n" + "Open a file (for low level IO).\n\n" + "Note that the mode argument is not currently supported on Jython."); - public static PyObject open(String path, int flag) { + public static FileIO open(String path, int flag) { return open(path, flag, 0777); } - public static PyObject open(String path, int flag, int mode) { + public static FileIO open(String path, int flag, int mode) { boolean reading = (flag & O_RDONLY) != 0; boolean writing = (flag & O_WRONLY) != 0; boolean updating = (flag & O_RDWR) != 0; @@ -181,18 +332,26 @@ String fileIOMode = (reading ? "r" : "") + (!appending && writing ? "w" : "") + (appending && (writing || updating) ? "a" : "") + (updating ? "+" : ""); - FileIO fileIO; if (sync && (writing || updating)) { try { - fileIO = new FileIO(new RandomAccessFile(file, "rws").getChannel(), fileIOMode); + return new FileIO(new RandomAccessFile(file, "rws").getChannel(), fileIOMode); } catch (FileNotFoundException fnfe) { throw Py.OSError(file.isDirectory() ? Errno.EISDIR : Errno.ENOENT, path); } - } else { - fileIO = new FileIO(path, fileIOMode); } + return new FileIO(path, fileIOMode); + } - return Py.java2py(fileIO); + public static PyString __doc__read = new PyString( + "read(fd, buffersize) -> string\n\n" + + "Read a file descriptor."); + public static String read(PyObject fd, int buffersize) { + try { + return StringUtil.fromBytes(FileDescriptors.get(fd).read(buffersize)); + } catch (PyException pye) { + badFD(); + return null; + } } public static PyString __doc__stat = new PyString( @@ -221,6 +380,18 @@ return new PyString(errno.toString()); } + public static PyString __doc__write = new PyString( + "write(fd, string) -> byteswritten\n\n" + + "Write a string to a file descriptor."); + public static int write(PyObject fd, String string) { + try { + return FileDescriptors.get(fd).write(ByteBuffer.wrap(StringUtil.toBytes(string))); + } catch (PyException pye) { + badFD(); + return -1; + } + } + /** * Helper function for the subprocess module, returns the potential shell commands for * this OS. @@ -259,6 +430,10 @@ return environ; } + private static void badFD() { + throw Py.OSError(Errno.EBADF); + } + public static POSIX getPOSIX() { return posix; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-24 05:46:42
|
Revision: 6898 http://jython.svn.sourceforge.net/jython/?rev=6898&view=rev Author: pjenvey Date: 2009-10-24 05:46:34 +0000 (Sat, 24 Oct 2009) Log Message: ----------- use the unsychronized size() call when we're already synchronized Modified Paths: -------------- trunk/jython/src/org/python/core/PyList.java Modified: trunk/jython/src/org/python/core/PyList.java =================================================================== --- trunk/jython/src/org/python/core/PyList.java 2009-10-24 04:34:03 UTC (rev 6897) +++ trunk/jython/src/org/python/core/PyList.java 2009-10-24 05:46:34 UTC (rev 6898) @@ -293,7 +293,7 @@ for (int i = 1; i < count; i++) { list.addAll(oldList); } - gListAllocatedStatus = __len__(); // now omit? + gListAllocatedStatus = list.size(); // now omit? return this; } @@ -473,7 +473,7 @@ @ExposedMethod(doc = BuiltinDocs.list_append_doc) final synchronized void list_append(PyObject o) { pyadd(o); - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } /** @@ -576,7 +576,7 @@ index = size(); } pyadd(index, o); - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } /** @@ -594,7 +594,7 @@ @ExposedMethod(doc = BuiltinDocs.list_remove_doc) final synchronized void list_remove(PyObject o) { del(_index(o, "list.remove(x): x not in list", 0, size())); - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } /** @@ -609,7 +609,7 @@ @ExposedMethod(doc = BuiltinDocs.list_reverse_doc) final synchronized void list_reverse() { Collections.reverse(list); - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } /** @@ -665,7 +665,7 @@ list.add(item); } } - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } @Override @@ -746,7 +746,7 @@ if (reverse) { Collections.reverse(list); // maintain stability of sort by reversing first } - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } private static class PyObjectDefaultComparator implements Comparator<PyObject> { @@ -790,7 +790,7 @@ if (reverse) { Collections.reverse(list); } - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } private static class PyObjectComparator implements Comparator<PyObject> { @@ -892,7 +892,7 @@ for (KV kv : decorated) { list.add(kv.value); } - gListAllocatedStatus = __len__(); + gListAllocatedStatus = list.size(); } public int hashCode() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-24 04:34:17
|
Revision: 6897 http://jython.svn.sourceforge.net/jython/?rev=6897&view=rev Author: pjenvey Date: 2009-10-24 04:34:03 +0000 (Sat, 24 Oct 2009) Log Message: ----------- treat numbers as smaller in _default_cmp's fallback fixes #1449 Modified Paths: -------------- trunk/jython/Lib/test/test_builtin_jy.py trunk/jython/Lib/test/test_cmp_jy.py trunk/jython/NEWS trunk/jython/src/org/python/core/PyObject.java Modified: trunk/jython/Lib/test/test_builtin_jy.py =================================================================== --- trunk/jython/Lib/test/test_builtin_jy.py 2009-10-24 04:21:18 UTC (rev 6896) +++ trunk/jython/Lib/test/test_builtin_jy.py 2009-10-24 04:34:03 UTC (rev 6897) @@ -25,6 +25,11 @@ return name self.assertEqual(dir(Foo()), []) + def test_numeric_cmp(self): + # http://bugs.jython.org/issue1449 + for numeric in 1, 2L, 3.0, 4j: + self.assertTrue(numeric < Ellipsis) + class LoopTest(unittest.TestCase): def test_break(self): Modified: trunk/jython/Lib/test/test_cmp_jy.py =================================================================== --- trunk/jython/Lib/test/test_cmp_jy.py 2009-10-24 04:21:18 UTC (rev 6896) +++ trunk/jython/Lib/test/test_cmp_jy.py 2009-10-24 04:34:03 UTC (rev 6897) @@ -60,15 +60,14 @@ baz.cmp = lambda other : Foo() self.assertEqual(cmp(100, baz), 0) baz.cmp = lambda other : NotImplemented - self.assertEqual(cmp(100, baz), 1) + # CPython is faulty here (returns 1) + self.assertEqual(cmp(100, baz), -1 if test_support.is_jython else 1) baz.cmp = lambda other: Bar() self.assertRaises(ValueError, cmp, 100, baz) baz.cmp = lambda other: 1 / 0 self.assertRaises(ZeroDivisionError, cmp, 100, baz) del Baz.__cmp__ - # CPython handles numbers differently than other types in - # object.c:default_3way_compare, and gets 1 here. we don't care - self.assert_(cmp(100, baz) in (-1, 1)) + self.assertEqual(cmp(100, baz), -1) def test_cmp_stops_short(self): class Foo(object): Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2009-10-24 04:21:18 UTC (rev 6896) +++ trunk/jython/NEWS 2009-10-24 04:34:03 UTC (rev 6897) @@ -4,6 +4,7 @@ Bugs Fixed - [ 1478 ] defaultdict & weakref.WeakKeyDictionary [TypeError: first argument must be callable] - [ 1487 ] Import of module with latin-1 chars fails on utf-8 file encoding + - [ 1449 ] Ellipsis comparison different from Python 2.5 to Jython 2.5 - Fix runtime issues during exitfuncs triggered via SystemRestart (such as during Django or Pylons development mode reloading) Modified: trunk/jython/src/org/python/core/PyObject.java =================================================================== --- trunk/jython/src/org/python/core/PyObject.java 2009-10-24 04:21:18 UTC (rev 6896) +++ trunk/jython/src/org/python/core/PyObject.java 2009-10-24 04:34:03 UTC (rev 6897) @@ -1299,25 +1299,33 @@ private final int _default_cmp(PyObject other) { int result; - if (this._is(other).__nonzero__()) + if (_is(other).__nonzero__()) return 0; /* None is smaller than anything */ - if (this == Py.None) + if (this == Py.None) { return -1; - if (other == Py.None) + } + if (other == Py.None) { return 1; + } // No rational way to compare these, so ask their classes to compare - PyType this_type = this.getType(); - PyType other_type = other.getType(); - if (this_type == other_type) { - return Py.id(this) < Py.id(other)? -1: 1; + PyType type = getType(); + PyType otherType = other.getType(); + if (type == otherType) { + return Py.id(this) < Py.id(other) ? -1 : 1; } - result = this_type.fastGetName().compareTo(other_type.fastGetName()); - if (result == 0) - return Py.id(this_type)<Py.id(other_type)? -1: 1; - return result < 0? -1: 1; + + // different type: compare type names; numbers are smaller + String typeName = isNumberType() ? "" : type.fastGetName(); + String otherTypeName = otherType.isNumberType() ? "" : otherType.fastGetName(); + result = typeName.compareTo(otherTypeName); + if (result == 0) { + // Same type name, or (more likely) incomparable numeric types + return Py.id(type) < Py.id(otherType) ? -1 : 1; + } + return result < 0 ? -1 : 1; } private final int _cmp_unsafe(PyObject other) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-24 04:21:42
|
Revision: 6896 http://jython.svn.sourceforge.net/jython/?rev=6896&view=rev Author: pjenvey Date: 2009-10-24 04:21:18 +0000 (Sat, 24 Oct 2009) Log Message: ----------- don't rely on jna directly as we'll likely swap to jffi/jnr-posix eventually Modified Paths: -------------- trunk/jython/src/org/python/core/util/PlatformUtil.java Modified: trunk/jython/src/org/python/core/util/PlatformUtil.java =================================================================== --- trunk/jython/src/org/python/core/util/PlatformUtil.java 2009-10-24 03:17:41 UTC (rev 6895) +++ trunk/jython/src/org/python/core/util/PlatformUtil.java 2009-10-24 04:21:18 UTC (rev 6896) @@ -1,9 +1,7 @@ -// Copyright (c) 2009 Jython project +/* Copyright (c) 2009 Jython project */ package org.python.core.util; -// Note: Sun does not sponsor the jna project, even though the package name -// might imply otherwise. -import com.sun.jna.Platform; +import org.jruby.ext.posix.util.Platform; /** * Methods for testing the platform/operating system that we are on. @@ -15,10 +13,10 @@ * where case insensitive means that a file that is stored as FOO * can be accessed as (for example) FoO. */ - //Currently we just check to see if we are on windows or macs, which are - //commonly (though not always!) case insensitive. There are certainly cases - //where this is not sufficient, like the case of mounted filesystems. public static boolean isCaseInsensitive() { - return Platform.isMac() || Platform.isWindows(); + // Currently we just check to see if we are on windows or macs, which are commonly + // (though not always!) case insensitive. There are certainly cases where this is + // not sufficient, like the case of mounted filesystems. + return Platform.IS_MAC || Platform.IS_WINDOWS; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-24 03:17:49
|
Revision: 6895 http://jython.svn.sourceforge.net/jython/?rev=6895&view=rev Author: fwierzbicki Date: 2009-10-24 03:17:41 +0000 (Sat, 24 Oct 2009) Log Message: ----------- move MethodHandle bytecode production into its own method. Modified Paths: -------------- branches/indy/src/org/python/compiler/Module.java Modified: branches/indy/src/org/python/compiler/Module.java =================================================================== --- branches/indy/src/org/python/compiler/Module.java 2009-10-24 03:11:46 UTC (rev 6894) +++ branches/indy/src/org/python/compiler/Module.java 2009-10-24 03:17:41 UTC (rev 6895) @@ -357,6 +357,22 @@ c.getstatic(module.classfile.name, name, ci(PyCode.class)); } + private void makeMethodHandle(Code c) { + c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodHandles", "lookup", "()Ljava/dyn/MethodHandles$Lookup;"); + c.visitLdcInsn(Type.getType("L"+module.classfile.name+";")); + c.visitLdcInsn(fname); + c.visitLdcInsn(Type.getType("Lorg/python/core/PyObject;")); + c.visitLdcInsn(Type.getType("Lorg/python/core/PyFrame;")); + c.visitInsn(ICONST_1); + c.visitTypeInsn(ANEWARRAY, "java/lang/Class"); + c.visitInsn(DUP); + c.visitInsn(ICONST_0); + c.visitLdcInsn(Type.getType("Lorg/python/core/ThreadState;")); + c.visitInsn(AASTORE); + c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodType", "make", "(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;"); + c.visitMethodInsn(INVOKEVIRTUAL, "java/dyn/MethodHandles$Lookup", "findVirtual", "(Ljava/lang/Class;Ljava/lang/String;Ljava/dyn/MethodType;)Ljava/dyn/MethodHandle;"); + } + void put(Code c) throws IOException { module.classfile.addField(name, ci(PyCode.class), access); c.iconst(argcount); @@ -379,23 +395,8 @@ c.getstatic(module.classfile.name, "self", "L" + module.classfile.name + ";"); - //REPLACING WITH METH HANDLE - //c.iconst(id); + makeMethodHandle(c); -c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodHandles", "lookup", "()Ljava/dyn/MethodHandles$Lookup;"); -c.visitLdcInsn(Type.getType("L"+module.classfile.name+";")); -c.visitLdcInsn(fname); -c.visitLdcInsn(Type.getType("Lorg/python/core/PyObject;")); -c.visitLdcInsn(Type.getType("Lorg/python/core/PyFrame;")); -c.visitInsn(ICONST_1); -c.visitTypeInsn(ANEWARRAY, "java/lang/Class"); -c.visitInsn(DUP); -c.visitInsn(ICONST_0); -c.visitLdcInsn(Type.getType("Lorg/python/core/ThreadState;")); -c.visitInsn(AASTORE); -c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodType", "make", "(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;"); -c.visitMethodInsn(INVOKEVIRTUAL, "java/dyn/MethodHandles$Lookup", "findVirtual", "(Ljava/lang/Class;Ljava/lang/String;Ljava/dyn/MethodType;)Ljava/dyn/MethodHandle;"); - if (cellvars != null) { int strArray = CodeCompiler.makeStrings(c, cellvars); c.aload(strArray); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-24 03:11:54
|
Revision: 6894 http://jython.svn.sourceforge.net/jython/?rev=6894&view=rev Author: pjenvey Date: 2009-10-24 03:11:46 +0000 (Sat, 24 Oct 2009) Log Message: ----------- improve isNumber/Mapping/SequenceType Modified Paths: -------------- trunk/jython/src/org/python/core/PyComplex.java trunk/jython/src/org/python/core/PyDictProxy.java trunk/jython/src/org/python/core/PyDictionary.java trunk/jython/src/org/python/core/PyFloat.java trunk/jython/src/org/python/core/PyInstance.java trunk/jython/src/org/python/core/PyInteger.java trunk/jython/src/org/python/core/PyLong.java trunk/jython/src/org/python/core/PyObject.java trunk/jython/src/org/python/core/PySequence.java trunk/jython/src/org/python/core/PyStringMap.java trunk/jython/src/org/python/modules/_collections/PyDeque.java Added Paths: ----------- trunk/jython/Lib/test/test_operator_jy.py Added: trunk/jython/Lib/test/test_operator_jy.py =================================================================== --- trunk/jython/Lib/test/test_operator_jy.py (rev 0) +++ trunk/jython/Lib/test/test_operator_jy.py 2009-10-24 03:11:46 UTC (rev 6894) @@ -0,0 +1,80 @@ +"""Misc operator module tests + +Made for Jython. +""" +import collections +import operator +import sys +import unittest +from test import test_support + +class OperatorTestCase(unittest.TestCase): + + class NewStyle(object): + pass + class OldStyle: + pass + class HasGetitem(object): + def __getitem__(self, name): + return 'foo' + class HasInt(object): + def __int__(self): + return 1 + class HasLong(object): + def __long__(self): + return 1 + class HasFloat(object): + def __float__(self): + return 1.0 + + # obj, isNumberType, isMappingType, isSequenceType + tests = ( + (type, False, False, False), + (type.__dict__, False, True, False), # dictproxy + (globals(), False, True, False), # stringmap + ({}, False, True, False), + ('', False, False, True), + (u'', False, False, True), + ([], False, False, True), + ((), False, False, True), + (xrange(5), False, False, True), + (set(), False, False, False), + (frozenset(), False, False, False), + (1, True, False, False), + (2L, True, False, False), + (3.0, True, False, False), + (4j, True, False, False), + (Exception(), False, False, True), + (collections.deque(), False, False, True), + (collections.defaultdict(), False, True, False), + (collections.namedtuple('test', 't'), False, False, False), + (NewStyle(), False, False, False), + (OldStyle(), not sys.platform.startswith('java'), False, False), + (HasGetitem(), False, True, True), + (HasInt(), True, False, False), + (HasFloat(), True, False, False), + ) + + def test_isNumberType(self): + for obj, isNumberType, _, _ in self.tests: + self.assert_istype(operator.isNumberType, obj, isNumberType) + + def test_isMappingType(self): + for obj, _, isMappingType, _ in self.tests: + self.assert_istype(operator.isMappingType, obj, isMappingType) + + def test_isSequenceType(self): + for obj, _, _, isSequenceType in self.tests: + self.assert_istype(operator.isSequenceType, obj, isSequenceType) + + def assert_istype(self, func, obj, result): + self.assertEqual(func(obj), result, '%s %s should be: %s' % + (type(obj), func.__name__, result)) + + +def test_main(): + test_support.run_unittest(OperatorTestCase) + + +if __name__ == "__main__": + test_main() Modified: trunk/jython/src/org/python/core/PyComplex.java =================================================================== --- trunk/jython/src/org/python/core/PyComplex.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyComplex.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -712,6 +712,8 @@ return complex___getnewargs__(); } - public boolean isMappingType() { return false; } - public boolean isSequenceType() { return false; } + @Override + public boolean isNumberType() { + return true; + } } Modified: trunk/jython/src/org/python/core/PyDictProxy.java =================================================================== --- trunk/jython/src/org/python/core/PyDictProxy.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyDictProxy.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -20,14 +20,17 @@ this.dict = dict; } + @Override public PyObject __iter__() { return dict.__iter__(); } + @Override public PyObject __finditem__(PyObject key) { return dict.__finditem__(key); } + @Override public int __len__() { return dict.__len__(); } @@ -87,6 +90,7 @@ return dict.invoke("copy"); } + @Override public int __cmp__(PyObject other) { return dictproxy___cmp__(other); } @@ -126,8 +130,19 @@ return dict.__ge__(other); } + @Override @ExposedMethod public PyString __str__() { return dict.__str__(); } + + @Override + public boolean isMappingType() { + return true; + } + + @Override + public boolean isSequenceType() { + return false; + } } Modified: trunk/jython/src/org/python/core/PyDictionary.java =================================================================== --- trunk/jython/src/org/python/core/PyDictionary.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyDictionary.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -676,6 +676,12 @@ throw Py.TypeError(String.format("unhashable type: '%.200s'", getType().fastGetName())); } + @Override + public boolean isMappingType() { + return true; + } + + @Override public boolean isSequenceType() { return false; } Modified: trunk/jython/src/org/python/core/PyFloat.java =================================================================== --- trunk/jython/src/org/python/core/PyFloat.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyFloat.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -628,6 +628,11 @@ return value; } + @Override + public boolean isNumberType() { + return true; + } + // standard singleton issues apply here to __getformat__/__setformat__, // but this is what Python demands @@ -681,8 +686,4 @@ } } } - - public boolean isMappingType() { return false; } - public boolean isSequenceType() { return false; } - } Modified: trunk/jython/src/org/python/core/PyInstance.java =================================================================== --- trunk/jython/src/org/python/core/PyInstance.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyInstance.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -174,6 +174,21 @@ } @Override + public boolean isNumberType() { + return __findattr__("__int__") != null || __findattr__("__float__") != null; + } + + @Override + public boolean isMappingType() { + return __findattr__("__getitem__") != null; + } + + @Override + public boolean isSequenceType() { + return __findattr__("__getitem__") != null; + } + + @Override public boolean isIndex() { return __findattr__("__index__") != null; } Modified: trunk/jython/src/org/python/core/PyInteger.java =================================================================== --- trunk/jython/src/org/python/core/PyInteger.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyInteger.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -825,6 +825,11 @@ } @Override + public boolean isNumberType() { + return true; + } + + @Override public boolean isIndex() { return true; } Modified: trunk/jython/src/org/python/core/PyLong.java =================================================================== --- trunk/jython/src/org/python/core/PyLong.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyLong.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -864,6 +864,11 @@ } @Override + public boolean isNumberType() { + return true; + } + + @Override public boolean isIndex() { return true; } Modified: trunk/jython/src/org/python/core/PyObject.java =================================================================== --- trunk/jython/src/org/python/core/PyObject.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyObject.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -523,20 +523,23 @@ return __call__(args, keywords); } - /* xxx fix these around */ - public boolean isCallable() { return getType().lookup("__call__") != null; } + public boolean isNumberType() { + PyType type = getType(); + return type.lookup("__int__") != null || type.lookup("__float__") != null; + } + public boolean isMappingType() { - return true; + PyType type = getType(); + return type.lookup("__getitem__") != null + && !(isSequenceType() && type.lookup("__getslice__") != null); } - public boolean isNumberType() { - return true; - } + public boolean isSequenceType() { - return true; + return getType().lookup("__getitem__") != null; } /** Modified: trunk/jython/src/org/python/core/PySequence.java =================================================================== --- trunk/jython/src/org/python/core/PySequence.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PySequence.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -414,6 +414,11 @@ return null; } + @Override + public boolean isSequenceType() { + return true; + } + protected final SequenceIndexDelegate delegator = new SequenceIndexDelegate() { @Override Modified: trunk/jython/src/org/python/core/PyStringMap.java =================================================================== --- trunk/jython/src/org/python/core/PyStringMap.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/core/PyStringMap.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -435,6 +435,16 @@ return new ValuesIter(table.values()); } + @Override + public boolean isMappingType() { + return true; + } + + @Override + public boolean isSequenceType() { + return false; + } + private abstract class StringMapIter<T> extends PyIterator { protected final Iterator<T> iterator; Modified: trunk/jython/src/org/python/modules/_collections/PyDeque.java =================================================================== --- trunk/jython/src/org/python/modules/_collections/PyDeque.java 2009-10-24 01:44:57 UTC (rev 6893) +++ trunk/jython/src/org/python/modules/_collections/PyDeque.java 2009-10-24 03:11:46 UTC (rev 6894) @@ -474,6 +474,16 @@ return pd; } + @Override + public boolean isMappingType() { + return false; + } + + @Override + public boolean isSequenceType() { + return true; + } + private static class Node { private Node left; private Node right; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-24 01:45:07
|
Revision: 6893 http://jython.svn.sourceforge.net/jython/?rev=6893&view=rev Author: pjenvey Date: 2009-10-24 01:44:57 +0000 (Sat, 24 Oct 2009) Log Message: ----------- remove dupe open name Modified Paths: -------------- trunk/jython/Lib/posix.py Modified: trunk/jython/Lib/posix.py =================================================================== --- trunk/jython/Lib/posix.py 2009-10-24 01:42:48 UTC (rev 6892) +++ trunk/jython/Lib/posix.py 2009-10-24 01:44:57 UTC (rev 6893) @@ -21,7 +21,7 @@ __all__ = [name for name in _posix.__all__ if not name.startswith('__doc__')] __all__.extend(['access', 'chdir', 'chmod', 'close', 'fdopen', 'fsync', 'ftruncate', 'getcwd', 'getcwdu', 'getenv', 'getpid', 'isatty', - 'lseek', 'mkdir', 'open', 'popen', 'putenv', 'read', 'remove', + 'lseek', 'mkdir', 'popen', 'putenv', 'read', 'remove', 'rename', 'rmdir', 'system', 'umask', 'unlink', 'unsetenv', 'urandom', 'utime', 'write']) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-24 01:43:08
|
Revision: 6892 http://jython.svn.sourceforge.net/jython/?rev=6892&view=rev Author: pjenvey Date: 2009-10-24 01:42:48 +0000 (Sat, 24 Oct 2009) Log Message: ----------- move os.open to PosixModule to fix the recent test_threaded_import regression Modified Paths: -------------- trunk/jython/Lib/posix.py trunk/jython/src/org/python/core/Py.java trunk/jython/src/org/python/modules/posix/PosixModule.java Modified: trunk/jython/Lib/posix.py =================================================================== --- trunk/jython/Lib/posix.py 2009-10-23 21:55:28 UTC (rev 6891) +++ trunk/jython/Lib/posix.py 2009-10-24 01:42:48 UTC (rev 6892) @@ -15,7 +15,7 @@ import stat as _stat import sys from java.io import File -from org.python.core.io import FileDescriptors, FileIO, IOBase +from org.python.core.io import FileDescriptors, IOBase from org.python.core.Py import newString as asPyString __all__ = [name for name in _posix.__all__ if not name.startswith('__doc__')] @@ -245,64 +245,6 @@ rawio = FileDescriptors.get(fd) return _handle_oserror(rawio.seek, pos, how) -def open(filename, flag, mode=0777): - """open(filename, flag [, mode=0777]) -> fd - - Open a file (for low level IO). - """ - reading = flag & O_RDONLY - writing = flag & O_WRONLY - updating = flag & O_RDWR - creating = flag & O_CREAT - - truncating = flag & O_TRUNC - exclusive = flag & O_EXCL - sync = flag & O_SYNC - appending = flag & O_APPEND - - if updating and writing: - raise OSError(errno.EINVAL, strerror(errno.EINVAL), filename) - - if not creating: - # raises ENOENT if it doesn't exist - stat(filename) - - if not writing: - if updating: - writing = True - else: - reading = True - - if truncating and not writing: - # Explicitly truncate, writing will truncate anyway - FileIO(filename, 'w').close() - - if exclusive and creating: - from java.io import IOException - try: - if not File(sys.getPath(filename)).createNewFile(): - raise OSError(errno.EEXIST, strerror(errno.EEXIST), - filename) - except IOException, ioe: - raise OSError(ioe) - - mode = '%s%s%s%s' % (reading and 'r' or '', - (not appending and writing) and 'w' or '', - (appending and (writing or updating)) and 'a' or '', - updating and '+' or '') - - if sync and (writing or updating): - from java.io import FileNotFoundException, RandomAccessFile - try: - fchannel = RandomAccessFile(sys.getPath(filename), 'rws').getChannel() - except FileNotFoundException, fnfe: - if _stat.S_ISDIR(stat(filename).st_mode): - raise OSError(errno.EISDIR, strerror(errno.EISDIR)) - raise OSError(errno.ENOENT, strerror(errno.ENOENT), filename) - return FileIO(fchannel, mode) - - return FileIO(filename, mode) - def read(fd, buffersize): """read(fd, buffersize) -> string Modified: trunk/jython/src/org/python/core/Py.java =================================================================== --- trunk/jython/src/org/python/core/Py.java 2009-10-23 21:55:28 UTC (rev 6891) +++ trunk/jython/src/org/python/core/Py.java 2009-10-24 01:42:48 UTC (rev 6892) @@ -104,6 +104,10 @@ return new PyException(Py.OSError, message); } + public static PyException OSError(IOException ioe) { + return fromIOException(ioe, Py.OSError); + } + public static PyException OSError(Constant errno, String filename) { int value = errno.value(); // Pass to strerror because constantine currently lacks Errno descriptions on @@ -158,16 +162,7 @@ public static PyObject IOError; public static PyException IOError(IOException ioe) { - String message = ioe.getMessage(); - if (message == null) { - message = ioe.getClass().getName(); - } - if (ioe instanceof FileNotFoundException) { - PyTuple args = new PyTuple(Py.newInteger(Errno.ENOENT.value()), - Py.newString("File not found - " + message)); - return new PyException(Py.IOError, args); - } - return new PyException(Py.IOError, message); + return fromIOException(ioe, Py.IOError); } public static PyException IOError(String message) { @@ -187,6 +182,19 @@ return new PyException(Py.IOError, args); } + private static PyException fromIOException(IOException ioe, PyObject err) { + String message = ioe.getMessage(); + if (message == null) { + message = ioe.getClass().getName(); + } + if (ioe instanceof FileNotFoundException) { + PyTuple args = new PyTuple(Py.newInteger(Errno.ENOENT.value()), + Py.newString("File not found - " + message)); + return new PyException(err, args); + } + return new PyException(err, message); + } + public static PyObject KeyError; public static PyException KeyError(String message) { Modified: trunk/jython/src/org/python/modules/posix/PosixModule.java =================================================================== --- trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-23 21:55:28 UTC (rev 6891) +++ trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-24 01:42:48 UTC (rev 6892) @@ -4,6 +4,10 @@ import com.kenai.constantine.Constant; import com.kenai.constantine.platform.Errno; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.RandomAccessFile; import java.util.Map; import org.jruby.ext.posix.JavaPOSIX; @@ -17,6 +21,7 @@ import org.python.core.PyObject; import org.python.core.PyString; import org.python.core.PyTuple; +import org.python.core.io.FileIO; import org.python.core.util.RelativeFile; /** @@ -42,16 +47,26 @@ /** Platform specific POSIX services. */ private static POSIX posix = POSIXFactory.getPOSIX(new PythonPOSIXHandler(), true); + /** os.open flags. */ + private static int O_RDONLY = 0x0; + private static int O_WRONLY = 0x1; + private static int O_RDWR = 0x2; + private static int O_APPEND = 0x8; + private static int O_SYNC = 0x80; + private static int O_CREAT = 0x200; + private static int O_TRUNC = 0x400; + private static int O_EXCL = 0x800; + public static void classDictInit(PyObject dict) { - // os.open flags, only expose what we support - dict.__setitem__("O_RDONLY", Py.newInteger(0x0)); - dict.__setitem__("O_WRONLY", Py.newInteger(0x1)); - dict.__setitem__("O_RDWR", Py.newInteger(0x2)); - dict.__setitem__("O_APPEND", Py.newInteger(0x8)); - dict.__setitem__("O_SYNC", Py.newInteger(0x80)); - dict.__setitem__("O_CREAT", Py.newInteger(0x200)); - dict.__setitem__("O_TRUNC", Py.newInteger(0x400)); - dict.__setitem__("O_EXCL", Py.newInteger(0x800)); + // only expose the open flags we support + dict.__setitem__("O_RDONLY", Py.newInteger(O_RDONLY)); + dict.__setitem__("O_WRONLY", Py.newInteger(O_WRONLY)); + dict.__setitem__("O_RDWR", Py.newInteger(O_RDWR)); + dict.__setitem__("O_APPEND", Py.newInteger(O_APPEND)); + dict.__setitem__("O_SYNC", Py.newInteger(O_SYNC)); + dict.__setitem__("O_CREAT", Py.newInteger(O_CREAT)); + dict.__setitem__("O_TRUNC", Py.newInteger(O_TRUNC)); + dict.__setitem__("O_EXCL", Py.newInteger(O_EXCL)); // os.access constants dict.__setitem__("F_OK", Py.Zero); @@ -115,6 +130,71 @@ return PyStatResult.fromFileStat(posix.lstat(new RelativeFile(path).getPath())); } + public static PyString __doc__open = new PyString( + "open(filename, flag [, mode=0777]) -> fd\n\n" + + "Open a file (for low level IO).\n\n" + + "Note that the mode argument is not currently supported on Jython."); + public static PyObject open(String path, int flag) { + return open(path, flag, 0777); + } + + public static PyObject open(String path, int flag, int mode) { + boolean reading = (flag & O_RDONLY) != 0; + boolean writing = (flag & O_WRONLY) != 0; + boolean updating = (flag & O_RDWR) != 0; + boolean creating = (flag & O_CREAT) != 0; + boolean appending = (flag & O_APPEND) != 0; + boolean truncating = (flag & O_TRUNC) != 0; + boolean exclusive = (flag & O_EXCL) != 0; + boolean sync = (flag & O_SYNC) != 0; + File file = new RelativeFile(path); + + if (updating && writing) { + throw Py.OSError(Errno.EINVAL, path); + } + if (!creating && !file.exists()) { + throw Py.OSError(Errno.ENOENT, path); + } + + if (!writing) { + if (updating) { + writing = true; + } else { + reading = true; + } + } + + if (truncating && !writing) { + // Explicitly truncate, writing will truncate anyway + new FileIO(path, "w").close(); + } + + if (exclusive && creating) { + try { + if (!file.createNewFile()) { + throw Py.OSError(Errno.EEXIST, path); + } + } catch (IOException ioe) { + throw Py.OSError(ioe); + } + } + + String fileIOMode = (reading ? "r" : "") + (!appending && writing ? "w" : "") + + (appending && (writing || updating) ? "a" : "") + (updating ? "+" : ""); + FileIO fileIO; + if (sync && (writing || updating)) { + try { + fileIO = new FileIO(new RandomAccessFile(file, "rws").getChannel(), fileIOMode); + } catch (FileNotFoundException fnfe) { + throw Py.OSError(file.isDirectory() ? Errno.EISDIR : Errno.ENOENT, path); + } + } else { + fileIO = new FileIO(path, fileIOMode); + } + + return Py.java2py(fileIO); + } + public static PyString __doc__stat = new PyString( "stat(path) -> stat result\n\n" + "Perform a stat system call on the given path.\n\n" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-23 21:55:36
|
Revision: 6891 http://jython.svn.sourceforge.net/jython/?rev=6891&view=rev Author: fwierzbicki Date: 2009-10-23 21:55:28 +0000 (Fri, 23 Oct 2009) Log Message: ----------- change a few calls to Codegen style, some cleanup. Modified Paths: -------------- branches/indy/src/org/python/compiler/Module.java Modified: branches/indy/src/org/python/compiler/Module.java =================================================================== --- branches/indy/src/org/python/compiler/Module.java 2009-10-23 19:10:19 UTC (rev 6890) +++ branches/indy/src/org/python/compiler/Module.java 2009-10-23 21:55:28 UTC (rev 6891) @@ -1,6 +1,7 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.compiler; +import java.dyn.MethodHandle; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; @@ -414,8 +415,11 @@ c.iconst(moreflags); - c.invokestatic("org/python/core/Py", "newCode", "(I" + $strArr + $str + $str + "IZZ" + - $pyFuncTbl + "Ljava/dyn/MethodHandle;" + $strArr + $strArr + "II)" + $pyCode); + c.invokestatic(p(Py.class), "newCode", sig(PyCode.class, Integer.TYPE, + String[].class, String.class, String.class, Integer.TYPE, Boolean.TYPE, + Boolean.TYPE, IndyFunctionTable.class, MethodHandle.class, String[].class, + String[].class, Integer.TYPE, Integer.TYPE)); + c.putstatic(module.classfile.name, name, ci(PyCode.class)); } } @@ -633,24 +637,15 @@ public void addFunctions() throws IOException { Code code = classfile.addMethod( "call_function", - "(Ljava/dyn/MethodHandle;" + $pyFrame + $threadState + ")" + $pyObj, + sig(PyObject.class, MethodHandle.class, PyFrame.class, ThreadState.class), ACC_PUBLIC); code.aload(1); // handle code.aload(0); // this code.aload(2); // frame code.aload(3); // thread state - /* - Label def = new Label(); - Label[] labels = new Label[codes.size()]; - int i; - for (i = 0; i < labels.length; i++) { - labels[i] = new Label(); - } - - */ - code.invokevirtual("java/dyn/MethodHandle", "invoke", "(Ljava/lang/Object;" + $pyFrame + - $threadState + ")" + $pyObj); + code.invokevirtual(p(MethodHandle.class), "invoke", + sig(PyObject.class, Object.class, PyFrame.class, ThreadState.class)); code.areturn(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-23 19:10:31
|
Revision: 6890 http://jython.svn.sourceforge.net/jython/?rev=6890&view=rev Author: fwierzbicki Date: 2009-10-23 19:10:19 +0000 (Fri, 23 Oct 2009) Log Message: ----------- Need to up permgen for regrtest and hardcode indy options in jython shell to get regrtest to run well. Modified Paths: -------------- branches/indy/build.xml branches/indy/src/shell/jython Modified: branches/indy/build.xml =================================================================== --- branches/indy/build.xml 2009-10-23 06:01:53 UTC (rev 6889) +++ branches/indy/build.xml 2009-10-23 19:10:19 UTC (rev 6890) @@ -910,6 +910,9 @@ <target name="regrtest" depends="developer-build,regrtest-unix,regrtest-windows"/> <target name="regrtest-unix" if="os.family.unix"> <exec executable="${dist.dir}/bin/jython"> + <!-- XXX hopefully maxperm won't be necessary once indy matures --> + <arg value="-J-XX:MaxPermSize=128M"/> + <arg value="${dist.dir}/Lib/test/regrtest.py"/> <!-- Only run the tests that are expected to work on Jython --> <arg value="--expected"/> Modified: branches/indy/src/shell/jython =================================================================== --- branches/indy/src/shell/jython 2009-10-23 06:01:53 UTC (rev 6889) +++ branches/indy/src/shell/jython 2009-10-23 19:10:19 UTC (rev 6890) @@ -244,6 +244,9 @@ fi fi +#XXX Hard code --boot for indy for now. +boot_requested=true + if [ -n "$profile_requested" -o -z "$boot_requested" ] ; then [ -n "$profile_requested" ] && echo "Running with instrumented profiler" java_args=("${java_args[@]}" -classpath "$CP$CP_DELIMITER$CLASSPATH") @@ -259,7 +262,9 @@ JAVA_CMD=(echo $JAVA_CMD) fi -"${JAVA_CMD[@]}" $JAVA_OPTS "${java_args[@]}" -Dpython.home="$JYTHON_HOME" \ +#XXX Hard code indy options for now +_INDY_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic" +"${JAVA_CMD[@]}" $JAVA_OPTS $_INDY_OPTS "${java_args[@]}" -Dpython.home="$JYTHON_HOME" \ -Dpython.executable="$PRG" org.python.util.jython $JYTHON_OPTS "$@" JYTHON_STATUS=$? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2009-10-23 06:01:59
|
Revision: 6889 http://jython.svn.sourceforge.net/jython/?rev=6889&view=rev Author: otmarhumbel Date: 2009-10-23 06:01:53 +0000 (Fri, 23 Oct 2009) Log Message: ----------- include the new extlibs/constantine.jar Modified Paths: -------------- trunk/jython/.classpath Modified: trunk/jython/.classpath =================================================================== --- trunk/jython/.classpath 2009-10-23 01:52:46 UTC (rev 6888) +++ trunk/jython/.classpath 2009-10-23 06:01:53 UTC (rev 6889) @@ -16,7 +16,7 @@ <classpathentry kind="lib" path="extlibs/antlr-runtime-3.1.3.jar"/> <classpathentry kind="lib" path="extlibs/asm-3.1.jar"/> <classpathentry kind="lib" path="extlibs/asm-commons-3.1.jar"/> - <classpathentry kind="lib" path="extlibs/constantine-0.4.jar"/> + <classpathentry kind="lib" path="extlibs/constantine.jar"/> <classpathentry kind="lib" path="extlibs/jna-posix.jar"/> <classpathentry kind="lib" path="extlibs/mockrunner-0.4.1/jar/jdom.jar"/> <classpathentry kind="lib" path="extlibs/mockrunner-0.4.1/lib/jdk1.5/j2ee1.3/mockrunner-servlet.jar"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-23 01:53:08
|
Revision: 6888 http://jython.svn.sourceforge.net/jython/?rev=6888&view=rev Author: pjenvey Date: 2009-10-23 01:52:46 +0000 (Fri, 23 Oct 2009) Log Message: ----------- only import UserDict when necessary Modified Paths: -------------- trunk/jython/Lib/os.py Modified: trunk/jython/Lib/os.py =================================================================== --- trunk/jython/Lib/os.py 2009-10-21 01:58:03 UTC (rev 6887) +++ trunk/jython/Lib/os.py 2009-10-23 01:52:46 UTC (rev 6888) @@ -403,8 +403,6 @@ except NameError: pass else: - import UserDict - # Fake unsetenv() for Windows # not sure about os2 here but # I'm guessing they are the same. @@ -417,6 +415,8 @@ # On RISC OS, all env access goes through getenv and putenv from riscosenviron import _Environ elif _name in ('os2', 'nt'): # Where Env Var Names Must Be UPPERCASE + import UserDict + # But we store them as upper case class _Environ(UserDict.IterableUserDict): def __init__(self, environ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-21 01:58:16
|
Revision: 6887 http://jython.svn.sourceforge.net/jython/?rev=6887&view=rev Author: fwierzbicki Date: 2009-10-21 01:58:03 +0000 (Wed, 21 Oct 2009) Log Message: ----------- Merged revisions 6815-6816,6818-6824,6826-6886 via svnmerge from https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython ........ r6815 | pjenvey | 2009-09-30 21:06:20 -0400 (Wed, 30 Sep 2009) | 2 lines allow del of default_factory, small cleanup ........ r6816 | pjenvey | 2009-09-30 21:13:04 -0400 (Wed, 30 Sep 2009) | 3 lines correct the callable check fixes #1478 ........ r6818 | fwierzbicki | 2009-09-30 21:25:40 -0400 (Wed, 30 Sep 2009) | 2 lines svn:ignore *$py.class in these. ........ r6819 | fwierzbicki | 2009-10-01 16:11:08 -0400 (Thu, 01 Oct 2009) | 4 lines Remove useless little inner subclasses, which where there just to add a behavior to nextToken() in Python.g -- since we override nextToken() in Python.g anyway, I relocated the functionality there. ........ r6820 | fwierzbicki | 2009-10-01 16:48:58 -0400 (Thu, 01 Oct 2009) | 3 lines Added a comment for trailing whitespace handling in single mode. Tobias asked me what it did and it took way too long to answer :) ........ r6821 | pjenvey | 2009-10-01 20:59:40 -0400 (Thu, 01 Oct 2009) | 2 lines small cleanup ........ r6822 | pjenvey | 2009-10-01 21:46:27 -0400 (Thu, 01 Oct 2009) | 3 lines allow exec of PyByteCode objects and simplify pycimport so it's not creating frames directly ........ r6823 | pjenvey | 2009-10-01 23:45:27 -0400 (Thu, 01 Oct 2009) | 2 lines pass the cached type through constructors ........ r6824 | pjenvey | 2009-10-02 00:05:54 -0400 (Fri, 02 Oct 2009) | 5 lines o convert PyFrame to exposed annotations o specify its cached type during construction to avoid repeated PyType.fromClass calls o fix the f_lineno value while tracing PyByteCode ........ r6826 | fwierzbicki | 2009-10-02 16:29:01 -0400 (Fri, 02 Oct 2009) | 2 lines Initial import of the part of JRuby's CodegenUtils that we can use. ........ r6827 | fwierzbicki | 2009-10-02 20:09:30 -0400 (Fri, 02 Oct 2009) | 2 lines First nibble at using CodegenUtils. ........ r6828 | fwierzbicki | 2009-10-02 20:48:54 -0400 (Fri, 02 Oct 2009) | 4 lines Converted almost all "org/python/Foo" to p(Foo.class). There is one I'm not sure about as it looks like "[org/python/core/PyObject" which doesn't make sense to me -- I'd expect "[Lorg/python/core/PyObject;". ........ r6829 | pjenvey | 2009-10-03 16:34:59 -0400 (Sat, 03 Oct 2009) | 3 lines add the ability for the method exposer to optionally pass in the current ThreadState when a method signature requests it @ arg 0 ........ r6830 | fwierzbicki | 2009-10-03 21:16:45 -0400 (Sat, 03 Oct 2009) | 2 lines Converted invokespecial and getfield to CodegenUtils. ........ r6831 | fwierzbicki | 2009-10-03 22:42:47 -0400 (Sat, 03 Oct 2009) | 3 lines Fix all invokevirtual to use sig() -- fix some invokespecial lines that went over 100 chars as per coding conventions. ........ r6832 | fwierzbicki | 2009-10-04 10:10:58 -0400 (Sun, 04 Oct 2009) | 2 lines Use sig() for invokestatic calls. ........ r6833 | fwierzbicki | 2009-10-04 10:39:40 -0400 (Sun, 04 Oct 2009) | 2 lines Finish up CodeCompiler conversion to CodegenUtils. ........ r6834 | fwierzbicki | 2009-10-04 11:10:21 -0400 (Sun, 04 Oct 2009) | 2 lines Use sig for invokevirtual. ........ r6835 | fwierzbicki | 2009-10-04 13:03:17 -0400 (Sun, 04 Oct 2009) | 2 lines use sig for invokestatic. ........ r6836 | fwierzbicki | 2009-10-04 16:16:12 -0400 (Sun, 04 Oct 2009) | 2 lines Use sig for invokespecial and addMethod. ........ r6837 | pjenvey | 2009-10-04 17:25:41 -0400 (Sun, 04 Oct 2009) | 3 lines hack around PyReflectedFunction's assumption of how instancemethod calls into it so instancemethod's ThreadState pass through optimization can be enabled ........ r6838 | fwierzbicki | 2009-10-04 18:31:22 -0400 (Sun, 04 Oct 2009) | 2 lines switch to p() from raw path strings where possible, also some cleanup. ........ r6839 | pjenvey | 2009-10-04 19:25:51 -0400 (Sun, 04 Oct 2009) | 4 lines only abspath module __file__s. the only other type having __file__ here is javapackage and their jar paths are already canonicalized by packagecache. saves maybe 150ms off startup ........ r6840 | amak | 2009-10-06 08:27:51 -0400 (Tue, 06 Oct 2009) | 3 lines Adding proper interpreter shutdown on servlet.destroy() for modjy. Fixes: http://bugs.jython.org/issue1474 Thanks to Colin Evans for reporting the issue. ........ r6841 | amak | 2009-10-06 08:38:52 -0400 (Tue, 06 Oct 2009) | 1 line Tabs to spaces. ........ r6842 | amak | 2009-10-06 09:11:06 -0400 (Tue, 06 Oct 2009) | 1 line Tabs to spaces, DOS line-endings to unix. ........ r6843 | fwierzbicki | 2009-10-06 16:32:55 -0400 (Tue, 06 Oct 2009) | 8 lines Make constants more.... constant in the compiler package. Changed confusing method names of the form Py*() that return constants to *constant. For example PyInteger() -> integerConstant(). Also reduced public interface of compiler package, especially around compiler constants. ........ r6844 | pjenvey | 2009-10-06 22:48:36 -0400 (Tue, 06 Oct 2009) | 6 lines optimize attr lookup on Deriveds inheriting object.__getattribute__: don't bother going through the descriptor. Derived's __findattr_ex__ now lives in a Deriveds util class (like java.util.Arrays/Collections but trickier to pronounce) so it can toggle the package private fast path flag on PyType fixes #1102 ........ r6845 | pjenvey | 2009-10-06 22:50:46 -0400 (Tue, 06 Oct 2009) | 1 line regen per r6844 ........ r6846 | fwierzbicki | 2009-10-07 15:16:54 -0400 (Wed, 07 Oct 2009) | 5 lines Make PyCodeConstant an actual constant. Move construction details into PyCodeConstant constructor. Hide more implementation details by making public fields package private. ........ r6847 | fwierzbicki | 2009-10-07 22:33:20 -0400 (Wed, 07 Oct 2009) | 2 lines Coding standards / Cleanup. ........ r6848 | fwierzbicki | 2009-10-07 23:30:17 -0400 (Wed, 07 Oct 2009) | 2 lines Coding standards / Cleanup. ........ r6849 | pjenvey | 2009-10-08 23:17:04 -0400 (Thu, 08 Oct 2009) | 1 line rearrange/cleanup by exposing __call__ with ThreadState ........ r6850 | fwierzbicki | 2009-10-09 14:32:33 -0400 (Fri, 09 Oct 2009) | 3 lines Make all of the fields in CodeCompiler private except "yields". I plan to make "yields" private as well, but that's going to take some surgery on Module. ........ r6851 | pjenvey | 2009-10-10 01:44:16 -0400 (Sat, 10 Oct 2009) | 3 lines after a SystemRestart don't reset PySystemState until after the exitfuncs are called, otherwise some strange problems can occur ........ r6852 | pjenvey | 2009-10-10 02:05:26 -0400 (Sat, 10 Oct 2009) | 3 lines add a flag to sys as a faster SystemRestart check for the code objects. otherwise currentThread().isInterrupted() is now a noticable performance hit ........ r6853 | pjenvey | 2009-10-12 01:04:37 -0400 (Mon, 12 Oct 2009) | 10 lines port Armin Rigo's global mro cache optimization from PyPy/CPython 2.6. unlike their's this version is thread safe (non-blocking). being global, it may become less optimal when shared by many PythonInterpreters/PySystemStates this provides a nice attribute lookup speedup but it can slow down silly things like class attribute counters (maybe due to our extra allocation around the cache invalidation) refs http://bugs.python.org/issue1700288 ........ r6854 | pjenvey | 2009-10-12 22:31:45 -0400 (Mon, 12 Oct 2009) | 2 lines move the cached objectGetattribute out of PyObject to ease bootstrapping ........ r6855 | pjenvey | 2009-10-13 23:19:24 -0400 (Tue, 13 Oct 2009) | 4 lines add support for specifying docstrings in ExposedType/ExposedGet annotations. exposed type.__doc__, which for the most part removes the need for PyObject.getDoc ........ r6856 | pjenvey | 2009-10-14 02:02:01 -0400 (Wed, 14 Oct 2009) | 2 lines docs galore, enable test_descr.descrdoc ........ r6857 | pjenvey | 2009-10-14 02:37:50 -0400 (Wed, 14 Oct 2009) | 2 lines add classmethod docs ........ r6858 | pjenvey | 2009-10-14 02:54:56 -0400 (Wed, 14 Oct 2009) | 1 line fix the docstring test ........ r6859 | amak | 2009-10-15 13:40:22 -0400 (Thu, 15 Oct 2009) | 1 line Checking in support for loading site-packages, through the use of imp.load("site"). Controlled with a "load_site_packages" option, which defaults to true. ........ r6860 | otmarhumbel | 2009-10-15 15:34:31 -0400 (Thu, 15 Oct 2009) | 1 line fixed javadoc warnings ........ r6861 | pjenvey | 2009-10-15 22:39:10 -0400 (Thu, 15 Oct 2009) | 1 line doc sets and BaseException ........ r6862 | pjenvey | 2009-10-15 22:41:41 -0400 (Thu, 15 Oct 2009) | 1 line toArray arg can't be null ........ r6863 | pjenvey | 2009-10-15 23:34:01 -0400 (Thu, 15 Oct 2009) | 1 line make the exposed methods final, cleanup ........ r6864 | pjenvey | 2009-10-16 01:51:46 -0400 (Fri, 16 Oct 2009) | 4 lines The GC thread should be able to safely create GeneratorExits now that PyExceptions no longer create tracebacks when constructed (and so don't immediately need a frame on hand). this speeds up generator construction ........ r6865 | pjenvey | 2009-10-16 22:11:46 -0400 (Fri, 16 Oct 2009) | 3 lines fast path lists along with tuples and avoid the overhead of __len__'ing generators which can be a somewhat common make_array argument ........ r6866 | amak | 2009-10-17 12:03:45 -0400 (Sat, 17 Oct 2009) | 1 line Fixing a previously unnoticed bug where a relative value for "python.home" was not being treated relative to the context root and should have been. ........ r6867 | amak | 2009-10-17 12:10:18 -0400 (Sat, 17 Oct 2009) | 1 line Adding a sample config value for load_site_packages. ........ r6868 | pjenvey | 2009-10-17 12:57:13 -0400 (Sat, 17 Oct 2009) | 2 lines hardcode the __new__ descriptors' __doc__ ........ r6869 | pjenvey | 2009-10-17 13:07:38 -0400 (Sat, 17 Oct 2009) | 2 lines expose PyFastSequenceIter and avoid PyType.fromClass during its construction ........ r6870 | pjenvey | 2009-10-18 14:59:19 -0400 (Sun, 18 Oct 2009) | 1 line cache TYPE ........ r6871 | pjenvey | 2009-10-19 00:56:15 -0400 (Mon, 19 Oct 2009) | 2 lines two exceptions walk into a bar. ouch! ........ r6872 | pjenvey | 2009-10-19 17:26:09 -0400 (Mon, 19 Oct 2009) | 2 lines bring in constantine 0.6 release, for OpenFlags ........ r6873 | pjenvey | 2009-10-19 17:56:07 -0400 (Mon, 19 Oct 2009) | 4 lines move os.py -> posix.py, in prep. for separating the posix bits from it os.py from: http://svn.python.org/projects/python/branches/release26-maint/Lib/os.py@75144 ........ r6874 | pjenvey | 2009-10-19 18:02:41 -0400 (Mon, 19 Oct 2009) | 10 lines o pull posix bits out of os into their own module o further pull some of the slower to initialize bits out of posix into a Java _posix (_nt on Windows) module. this speeds up startup. eventually we should move more if not everything there o adapt 2.6's os.py: - hide exec* - we don't need to use set/get/putenv for the environ dict wrapper - our stat_result can be pickled, remove the copy_reg workaround - re-add some 2.5isms ........ r6875 | pjenvey | 2009-10-19 18:04:02 -0400 (Mon, 19 Oct 2009) | 2 lines remove the platform hiding functionality, until we actually need it ........ r6876 | pjenvey | 2009-10-19 18:08:32 -0400 (Mon, 19 Oct 2009) | 1 line unused imports ........ r6877 | pjenvey | 2009-10-19 20:06:05 -0400 (Mon, 19 Oct 2009) | 1 line don't hardcode the platform module name ........ r6878 | pjenvey | 2009-10-19 20:20:58 -0400 (Mon, 19 Oct 2009) | 5 lines o jna-posix does the pure java stat for us, simplify it + move it to PosixModule o move strerror to PosixModule because it does the work of falling back to Linux errno descriptions on Windows, and we need that from some Java calls ........ r6879 | pjenvey | 2009-10-19 20:54:00 -0400 (Mon, 19 Oct 2009) | 3 lines o constantine lacks sensible Windows OpenFlags constants, roll our own o fix put/unset/getenv on Windows ........ r6880 | pjenvey | 2009-10-19 21:15:51 -0400 (Mon, 19 Oct 2009) | 2 lines move the environ dict into the more appropriate PosixModule ........ r6881 | pjenvey | 2009-10-19 21:20:43 -0400 (Mon, 19 Oct 2009) | 1 line avoid the types import ........ r6882 | pjenvey | 2009-10-19 23:28:30 -0400 (Mon, 19 Oct 2009) | 1 line only import these when necessary ........ r6883 | pjenvey | 2009-10-19 23:43:46 -0400 (Mon, 19 Oct 2009) | 1 line identify reflected funcs as routines so they can show up in help() ........ r6884 | pjenvey | 2009-10-20 00:04:53 -0400 (Tue, 20 Oct 2009) | 2 lines move _exit/listdir to PosixModule, get rid of a duplicate getlogin impl ........ r6885 | pjenvey | 2009-10-20 00:24:54 -0400 (Tue, 20 Oct 2009) | 2 lines fix missing imports and reference to now fixed os.__name__ ........ r6886 | pjenvey | 2009-10-20 00:25:15 -0400 (Tue, 20 Oct 2009) | 4 lines don't decode bytes when searching for an encoding defined in an InputStream thanks artichoke fixes #1487 ........ Modified Paths: -------------- branches/indy/CoreExposed.includes branches/indy/Demo/modjy_webapp/WEB-INF/web.xml branches/indy/Lib/grp.py branches/indy/Lib/inspect.py branches/indy/Lib/modjy/__init__.py branches/indy/Lib/modjy/modjy.py branches/indy/Lib/modjy/modjy_exceptions.py branches/indy/Lib/modjy/modjy_impl.py branches/indy/Lib/modjy/modjy_log.py branches/indy/Lib/modjy/modjy_params.py branches/indy/Lib/modjy/modjy_publish.py branches/indy/Lib/modjy/modjy_response.py branches/indy/Lib/modjy/modjy_write.py branches/indy/Lib/modjy/modjy_wsgi.py branches/indy/Lib/ntpath.py branches/indy/Lib/posixpath.py branches/indy/Lib/pwd.py branches/indy/Lib/pycimport.py branches/indy/Lib/select.py branches/indy/Lib/site.py branches/indy/Lib/subprocess.py branches/indy/Lib/test/test_descr.py branches/indy/Lib/test/test_fileno.py branches/indy/Lib/test/test_import_jy.py branches/indy/Misc/make_pydocs.py branches/indy/NEWS branches/indy/build.xml branches/indy/grammar/Python.g branches/indy/grammar/PythonPartial.g branches/indy/src/com/xhaus/modjy/ModjyJServlet.java branches/indy/src/org/python/antlr/BaseParser.java branches/indy/src/org/python/antlr/PythonTree.java branches/indy/src/org/python/antlr/ast/AssertDerived.java branches/indy/src/org/python/antlr/ast/AssignDerived.java branches/indy/src/org/python/antlr/ast/AttributeDerived.java branches/indy/src/org/python/antlr/ast/AugAssignDerived.java branches/indy/src/org/python/antlr/ast/BinOpDerived.java branches/indy/src/org/python/antlr/ast/BoolOpDerived.java branches/indy/src/org/python/antlr/ast/BreakDerived.java branches/indy/src/org/python/antlr/ast/CallDerived.java branches/indy/src/org/python/antlr/ast/ClassDefDerived.java branches/indy/src/org/python/antlr/ast/CompareDerived.java branches/indy/src/org/python/antlr/ast/ContinueDerived.java branches/indy/src/org/python/antlr/ast/DeleteDerived.java branches/indy/src/org/python/antlr/ast/DictDerived.java branches/indy/src/org/python/antlr/ast/EllipsisDerived.java branches/indy/src/org/python/antlr/ast/ExceptHandlerDerived.java branches/indy/src/org/python/antlr/ast/ExecDerived.java branches/indy/src/org/python/antlr/ast/ExprDerived.java branches/indy/src/org/python/antlr/ast/ExpressionDerived.java branches/indy/src/org/python/antlr/ast/ExtSliceDerived.java branches/indy/src/org/python/antlr/ast/ForDerived.java branches/indy/src/org/python/antlr/ast/FunctionDefDerived.java branches/indy/src/org/python/antlr/ast/GeneratorExpDerived.java branches/indy/src/org/python/antlr/ast/GlobalDerived.java branches/indy/src/org/python/antlr/ast/IfDerived.java branches/indy/src/org/python/antlr/ast/IfExpDerived.java branches/indy/src/org/python/antlr/ast/ImportDerived.java branches/indy/src/org/python/antlr/ast/ImportFromDerived.java branches/indy/src/org/python/antlr/ast/IndexDerived.java branches/indy/src/org/python/antlr/ast/InteractiveDerived.java branches/indy/src/org/python/antlr/ast/LambdaDerived.java branches/indy/src/org/python/antlr/ast/ListCompDerived.java branches/indy/src/org/python/antlr/ast/ListDerived.java branches/indy/src/org/python/antlr/ast/ModuleDerived.java branches/indy/src/org/python/antlr/ast/NameDerived.java branches/indy/src/org/python/antlr/ast/NumDerived.java branches/indy/src/org/python/antlr/ast/PassDerived.java branches/indy/src/org/python/antlr/ast/PrintDerived.java branches/indy/src/org/python/antlr/ast/RaiseDerived.java branches/indy/src/org/python/antlr/ast/ReprDerived.java branches/indy/src/org/python/antlr/ast/ReturnDerived.java branches/indy/src/org/python/antlr/ast/SliceDerived.java branches/indy/src/org/python/antlr/ast/StrDerived.java branches/indy/src/org/python/antlr/ast/SubscriptDerived.java branches/indy/src/org/python/antlr/ast/SuiteDerived.java branches/indy/src/org/python/antlr/ast/TryExceptDerived.java branches/indy/src/org/python/antlr/ast/TryFinallyDerived.java branches/indy/src/org/python/antlr/ast/TupleDerived.java branches/indy/src/org/python/antlr/ast/UnaryOpDerived.java branches/indy/src/org/python/antlr/ast/WhileDerived.java branches/indy/src/org/python/antlr/ast/WithDerived.java branches/indy/src/org/python/antlr/ast/YieldDerived.java branches/indy/src/org/python/antlr/ast/aliasDerived.java branches/indy/src/org/python/antlr/ast/argumentsDerived.java branches/indy/src/org/python/antlr/ast/comprehensionDerived.java branches/indy/src/org/python/antlr/ast/keywordDerived.java branches/indy/src/org/python/antlr/op/AddDerived.java branches/indy/src/org/python/antlr/op/AndDerived.java branches/indy/src/org/python/antlr/op/AugLoadDerived.java branches/indy/src/org/python/antlr/op/AugStoreDerived.java branches/indy/src/org/python/antlr/op/BitAndDerived.java branches/indy/src/org/python/antlr/op/BitOrDerived.java branches/indy/src/org/python/antlr/op/BitXorDerived.java branches/indy/src/org/python/antlr/op/DelDerived.java branches/indy/src/org/python/antlr/op/DivDerived.java branches/indy/src/org/python/antlr/op/EqDerived.java branches/indy/src/org/python/antlr/op/FloorDivDerived.java branches/indy/src/org/python/antlr/op/GtDerived.java branches/indy/src/org/python/antlr/op/GtEDerived.java branches/indy/src/org/python/antlr/op/InDerived.java branches/indy/src/org/python/antlr/op/InvertDerived.java branches/indy/src/org/python/antlr/op/IsDerived.java branches/indy/src/org/python/antlr/op/IsNotDerived.java branches/indy/src/org/python/antlr/op/LShiftDerived.java branches/indy/src/org/python/antlr/op/LoadDerived.java branches/indy/src/org/python/antlr/op/LtDerived.java branches/indy/src/org/python/antlr/op/LtEDerived.java branches/indy/src/org/python/antlr/op/ModDerived.java branches/indy/src/org/python/antlr/op/MultDerived.java branches/indy/src/org/python/antlr/op/NotDerived.java branches/indy/src/org/python/antlr/op/NotEqDerived.java branches/indy/src/org/python/antlr/op/NotInDerived.java branches/indy/src/org/python/antlr/op/OrDerived.java branches/indy/src/org/python/antlr/op/ParamDerived.java branches/indy/src/org/python/antlr/op/PowDerived.java branches/indy/src/org/python/antlr/op/RShiftDerived.java branches/indy/src/org/python/antlr/op/StoreDerived.java branches/indy/src/org/python/antlr/op/SubDerived.java branches/indy/src/org/python/antlr/op/UAddDerived.java branches/indy/src/org/python/antlr/op/USubDerived.java branches/indy/src/org/python/compiler/CodeCompiler.java branches/indy/src/org/python/compiler/Constant.java branches/indy/src/org/python/compiler/Module.java branches/indy/src/org/python/core/BuiltinDocs.java branches/indy/src/org/python/core/ClasspathPyImporterDerived.java branches/indy/src/org/python/core/ParserFacade.java branches/indy/src/org/python/core/Py.java branches/indy/src/org/python/core/PyArrayDerived.java branches/indy/src/org/python/core/PyBaseCode.java branches/indy/src/org/python/core/PyBaseException.java branches/indy/src/org/python/core/PyBaseExceptionDerived.java branches/indy/src/org/python/core/PyBaseString.java branches/indy/src/org/python/core/PyBoolean.java branches/indy/src/org/python/core/PyBooleanDerived.java branches/indy/src/org/python/core/PyBuiltinCallable.java branches/indy/src/org/python/core/PyCell.java branches/indy/src/org/python/core/PyClassMethod.java branches/indy/src/org/python/core/PyClassMethodDerived.java branches/indy/src/org/python/core/PyClassMethodDescr.java branches/indy/src/org/python/core/PyComplex.java branches/indy/src/org/python/core/PyComplexDerived.java branches/indy/src/org/python/core/PyDataDescr.java branches/indy/src/org/python/core/PyDictionary.java branches/indy/src/org/python/core/PyDictionaryDerived.java branches/indy/src/org/python/core/PyEnumerate.java branches/indy/src/org/python/core/PyEnumerateDerived.java branches/indy/src/org/python/core/PyFastSequenceIter.java branches/indy/src/org/python/core/PyFile.java branches/indy/src/org/python/core/PyFileDerived.java branches/indy/src/org/python/core/PyFloat.java branches/indy/src/org/python/core/PyFloatDerived.java branches/indy/src/org/python/core/PyFrame.java branches/indy/src/org/python/core/PyFrozenSet.java branches/indy/src/org/python/core/PyFrozenSetDerived.java branches/indy/src/org/python/core/PyFunction.java branches/indy/src/org/python/core/PyGenerator.java branches/indy/src/org/python/core/PyInteger.java branches/indy/src/org/python/core/PyIntegerDerived.java branches/indy/src/org/python/core/PyJavaType.java branches/indy/src/org/python/core/PyList.java branches/indy/src/org/python/core/PyListDerived.java branches/indy/src/org/python/core/PyLong.java branches/indy/src/org/python/core/PyLongDerived.java branches/indy/src/org/python/core/PyMethod.java branches/indy/src/org/python/core/PyMethodDescr.java branches/indy/src/org/python/core/PyModule.java branches/indy/src/org/python/core/PyModuleDerived.java branches/indy/src/org/python/core/PyNewWrapper.java branches/indy/src/org/python/core/PyObject.java branches/indy/src/org/python/core/PyObjectDerived.java branches/indy/src/org/python/core/PyProperty.java branches/indy/src/org/python/core/PyPropertyDerived.java branches/indy/src/org/python/core/PyReflectedConstructor.java branches/indy/src/org/python/core/PyReflectedFunction.java branches/indy/src/org/python/core/PySet.java branches/indy/src/org/python/core/PySetDerived.java branches/indy/src/org/python/core/PySlice.java branches/indy/src/org/python/core/PySliceDerived.java branches/indy/src/org/python/core/PyStaticMethod.java branches/indy/src/org/python/core/PyString.java branches/indy/src/org/python/core/PyStringDerived.java branches/indy/src/org/python/core/PySuper.java branches/indy/src/org/python/core/PySuperDerived.java branches/indy/src/org/python/core/PySystemState.java branches/indy/src/org/python/core/PyTableCode.java branches/indy/src/org/python/core/PyTraceback.java branches/indy/src/org/python/core/PyTuple.java branches/indy/src/org/python/core/PyTupleDerived.java branches/indy/src/org/python/core/PyType.java branches/indy/src/org/python/core/PyTypeDerived.java branches/indy/src/org/python/core/PyUnicode.java branches/indy/src/org/python/core/PyUnicodeDerived.java branches/indy/src/org/python/core/PyXRange.java branches/indy/src/org/python/core/ReflectedArgs.java branches/indy/src/org/python/core/exceptions.java branches/indy/src/org/python/core/io/FileIO.java branches/indy/src/org/python/core/io/StreamIO.java branches/indy/src/org/python/core/util/FileUtil.java branches/indy/src/org/python/expose/BaseTypeBuilder.java branches/indy/src/org/python/expose/ExposedClassMethod.java branches/indy/src/org/python/expose/ExposedGet.java branches/indy/src/org/python/expose/ExposedType.java branches/indy/src/org/python/expose/TypeBuilder.java branches/indy/src/org/python/expose/generate/ClassMethodExposer.java branches/indy/src/org/python/expose/generate/DescriptorExposer.java branches/indy/src/org/python/expose/generate/DescriptorVisitor.java branches/indy/src/org/python/expose/generate/ExposedFieldFinder.java branches/indy/src/org/python/expose/generate/ExposedMethodFinder.java branches/indy/src/org/python/expose/generate/ExposedTypeProcessor.java branches/indy/src/org/python/expose/generate/ExposedTypeVisitor.java branches/indy/src/org/python/expose/generate/InstanceMethodExposer.java branches/indy/src/org/python/expose/generate/MethodExposer.java branches/indy/src/org/python/expose/generate/PyTypes.java branches/indy/src/org/python/expose/generate/TypeExposer.java branches/indy/src/org/python/modules/Setup.java branches/indy/src/org/python/modules/_collections/PyDefaultDict.java branches/indy/src/org/python/modules/_collections/PyDefaultDictDerived.java branches/indy/src/org/python/modules/_collections/PyDequeDerived.java branches/indy/src/org/python/modules/_csv/PyDialectDerived.java branches/indy/src/org/python/modules/_functools/PyPartialDerived.java branches/indy/src/org/python/modules/_weakref/ReferenceTypeDerived.java branches/indy/src/org/python/modules/cPickle.java branches/indy/src/org/python/modules/cStringIO.java branches/indy/src/org/python/modules/itertools.java branches/indy/src/org/python/modules/random/PyRandomDerived.java branches/indy/src/org/python/modules/thread/PyLocalDerived.java branches/indy/src/org/python/modules/zipimport/zipimporterDerived.java branches/indy/src/org/python/util/jython.java branches/indy/src/templates/object.derived branches/indy/tests/java/org/python/antlr/PythonPartialTester.java branches/indy/tests/java/org/python/antlr/PythonTreeTester.java branches/indy/tests/java/org/python/expose/generate/ExposeMethodFinderTest.java branches/indy/tests/java/org/python/expose/generate/ExposedTypeProcessorTest.java branches/indy/tests/java/org/python/expose/generate/ExposedTypeVisitorTest.java branches/indy/tests/java/org/python/expose/generate/MethodExposerTest.java branches/indy/tests/java/org/python/expose/generate/SimpleExposed.java branches/indy/tests/java/org/python/expose/generate/TypeExposerTest.java branches/indy/tests/modjy/java/com/xhaus/modjy/ModjyTestBase.java branches/indy/tests/modjy/java/com/xhaus/modjy/ModjyTestContentHeaders.java branches/indy/tests/modjy/test_apps_dir/content_header_tests.py branches/indy/tests/modjy/test_apps_dir/environ_tests.py branches/indy/tests/modjy/test_apps_dir/header_tests.py branches/indy/tests/modjy/test_apps_dir/return_tests.py branches/indy/tests/modjy/test_apps_dir/simple_app.py branches/indy/tests/modjy/test_apps_dir/stream_tests.py branches/indy/tests/modjy/test_apps_dir/web_inf_tests.py Added Paths: ----------- branches/indy/Lib/nt.py branches/indy/Lib/os.py branches/indy/Lib/posix.py branches/indy/Lib/test/test_inspect_jy.py branches/indy/extlibs/constantine.jar branches/indy/src/org/python/core/Deriveds.java branches/indy/src/org/python/modules/posix/ branches/indy/src/org/python/modules/posix/OS.java branches/indy/src/org/python/modules/posix/PosixModule.java branches/indy/src/org/python/modules/posix/PyStatResult.java branches/indy/src/org/python/modules/posix/PythonPOSIXHandler.java branches/indy/tests/modjy/java/com/xhaus/modjy/ModjyTestInterpreterLifecycle.java branches/indy/tests/modjy/test_apps_dir/lifecycle_tests.py Removed Paths: ------------- branches/indy/Lib/os.py branches/indy/Lib/posix.py branches/indy/extlibs/constantine-0.4.jar branches/indy/src/org/python/modules/posix/OS.java branches/indy/src/org/python/modules/posix/PosixModule.java branches/indy/src/org/python/modules/posix/PyStatResult.java branches/indy/src/org/python/modules/posix/PythonPOSIXHandler.java Property Changed: ---------------- branches/indy/ branches/indy/Lib/collections/ branches/indy/Lib/compiler/ branches/indy/Lib/distutils/ branches/indy/Lib/distutils/command/ branches/indy/Lib/distutils/tests/ branches/indy/Lib/modjy/ branches/indy/Lib/test/bugs/ branches/indy/Lib/test/bugs/pr133/ branches/indy/Lib/test/pbcvm/test/ branches/indy/Lib/test/pyservlet/ branches/indy/Lib/test/test_metaclass_support/ branches/indy/Lib/test/zxjdbc/ branches/indy/Lib/xml/etree/ branches/indy/Lib/xml/parsers/ branches/indy/extlibs/xercesImpl-2.9.1.jar branches/indy/tests/java/org/python/tests/RedundantInterfaceDeclarations.java Property changes on: branches/indy ___________________________________________________________________ Modified: svnmerge-integrated - /trunk/jython:1-6814 + /trunk/jython:1-6886 Modified: svn:mergeinfo - /branches/jsr223:6285-6565 /branches/newstyle-java-types:5564-5663,5666-5729 /trunk/jython:6662-6741,6762-6814 + /branches/jsr223:6285-6565 /branches/newstyle-java-types:5564-5663,5666-5729 /trunk/jython:6662-6741,6762-6886 Modified: branches/indy/CoreExposed.includes =================================================================== --- branches/indy/CoreExposed.includes 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/CoreExposed.includes 2009-10-21 01:58:03 UTC (rev 6887) @@ -15,8 +15,10 @@ org/python/core/PyDictProxy.class org/python/core/PyEnumerate.class org/python/core/PyEllipsis.class +org/python/core/PyFastSequenceIter.class org/python/core/PyFile.class org/python/core/PyFloat.class +org/python/core/PyFrame.class org/python/core/PyFrozenSet.class org/python/core/PyFunction.class org/python/core/PyGenerator.class @@ -59,6 +61,7 @@ org/python/modules/_weakref/ReferenceType.class org/python/modules/operator$PyAttrGetter.class org/python/modules/operator$PyItemGetter.class +org/python/modules/posix/PyStatResult.class org/python/modules/random/PyRandom.class org/python/modules/thread/PyLocal.class org/python/modules/time/PyTimeTuple.class Modified: branches/indy/Demo/modjy_webapp/WEB-INF/web.xml =================================================================== --- branches/indy/Demo/modjy_webapp/WEB-INF/web.xml 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/Demo/modjy_webapp/WEB-INF/web.xml 2009-10-21 01:58:03 UTC (rev 6887) @@ -6,7 +6,7 @@ <display-name>modjy demo application</display-name> <description> - modjy WSGI demo application + modjy WSGI demo application </description> <servlet> @@ -15,58 +15,67 @@ <init-param> <param-name>python.home</param-name> <param-value>C:/jython2.5</param-value> - </init-param> -<!-- - There are two different ways you can specify an application to modjy - 1. Using the app_import_name mechanism - 2. Using a combination of app_directory/app_filename/app_callable_name - Examples of both are given below - See the documenation for more details. + </init-param> +<!-- + There are two different ways you can specify an application to modjy + 1. Using the app_import_name mechanism + 2. Using a combination of app_directory/app_filename/app_callable_name + Examples of both are given below + See the documenation for more details. http://modjy.xhaus.com/locating.html#locating_callables ---> -<!-- - This is the app_import_name mechanism. If you specify a value - for this variable, then it will take precedence over the other mechanism +--> +<!-- + This is the app_import_name mechanism. If you specify a value + for this variable, then it will take precedence over the other mechanism <init-param> <param-name>app_import_name</param-name> <param-value>my_wsgi_module.my_handler_class().handler_method</param-value> - </init-param> + </init-param> --> -<!-- - And this is the app_directory/app_filename/app_callable_name combo - The defaults for these three variables are ""/application.py/handler - So if you specify no values at all for any of app_* variables, then modjy - will by default look for "handler" in "application.py" in the servlet - context root. +<!-- + And this is the app_directory/app_filename/app_callable_name combo + The defaults for these three variables are ""/application.py/handler + So if you specify no values at all for any of app_* variables, then modjy + will by default look for "handler" in "application.py" in the servlet + context root. <init-param> <param-name>app_directory</param-name> <param-value>some_sub_directory</param-value> - </init-param> + </init-param> --> <init-param> <param-name>app_filename</param-name> <param-value>demo_app.py</param-value> </init-param> -<!-- - Supply a value for this parameter if you want your application - callable to have a different name than the default. +<!-- + Supply a value for this parameter if you want your application + callable to have a different name than the default. <init-param> <param-name>app_callable_name</param-name> <param-value>my_handler_func</param-value> </init-param> ---> - <!-- Do you want application callables to be cached? --> +--> + <!-- Do you want application callables to be cached? --> <init-param> <param-name>cache_callables</param-name> <param-value>1</param-value> - </init-param> - <!-- Should the application be reloaded if it's .py file changes? --> + </init-param> + <!-- Should the application be reloaded if it's .py file changes? --> <!-- Does not work with the app_import_name mechanism --> <init-param> <param-name>reload_on_mod</param-name> <param-value>1</param-value> </init-param> + <!-- + Is site-packages to be loaded through imp.load("site")? + Same as -S option to command line interpreter + --> <init-param> + <param-name>load_site_packages</param-name> + <param-value>1</param-value> +<!-- <param-value>0</param-value> --> + </init-param> + <init-param> <param-name>log_level</param-name> <param-value>debug</param-value> <!-- <param-value>info</param-value> --> Property changes on: branches/indy/Lib/collections ___________________________________________________________________ Added: svn:ignore + *$py.class Property changes on: branches/indy/Lib/compiler ___________________________________________________________________ Added: svn:ignore + *$py.class Property changes on: branches/indy/Lib/distutils ___________________________________________________________________ Added: svn:ignore + *$py.class Property changes on: branches/indy/Lib/distutils/command ___________________________________________________________________ Added: svn:ignore + *$py.class Property changes on: branches/indy/Lib/distutils/tests ___________________________________________________________________ Added: svn:ignore + *$py.class Modified: branches/indy/Lib/grp.py =================================================================== --- branches/indy/Lib/grp.py 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/Lib/grp.py 2009-10-21 01:58:03 UTC (rev 6887) @@ -17,7 +17,7 @@ __all__ = ['getgrgid', 'getgrnam', 'getgrall'] -from os import _name, _posix +from os import _name, _posix_impl if _name == 'nt': raise ImportError, 'grp module not supported on Windows' @@ -50,7 +50,7 @@ Return the group database entry for the given numeric group ID. If id is not valid, raise KeyError. """ - entry = _posix.getgrgid(uid) + entry = _posix_impl.getgrgid(uid) if not entry: raise KeyError(uid) return struct_group(entry) @@ -62,7 +62,7 @@ Return the group database entry for the given group name. If name is not valid, raise KeyError. """ - entry = _posix.getgrnam(name) + entry = _posix_impl.getgrnam(name) if not entry: raise KeyError(name) return struct_group(entry) @@ -76,7 +76,7 @@ """ groups = [] while True: - group = _posix.getgrent() + group = _posix_impl.getgrent() if not group: break groups.append(struct_group(group)) Modified: branches/indy/Lib/inspect.py =================================================================== --- branches/indy/Lib/inspect.py 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/Lib/inspect.py 2009-10-21 01:58:03 UTC (rev 6887) @@ -30,6 +30,7 @@ import sys, os, types, string, re, dis, imp, tokenize, linecache from operator import attrgetter +ReflectedFunctionType = type(os.listdir) # ----------------------------------------------------------- type-checking def ismodule(object): @@ -196,7 +197,8 @@ return (isbuiltin(object) or isfunction(object) or ismethod(object) - or ismethoddescriptor(object)) + or ismethoddescriptor(object) + or isinstance(object, ReflectedFunctionType)) def getmembers(object, predicate=None): """Return all members of an object as (name, value) pairs sorted by name. Property changes on: branches/indy/Lib/modjy ___________________________________________________________________ Added: svn:ignore + *$py.class Modified: branches/indy/Lib/modjy/__init__.py =================================================================== --- branches/indy/Lib/modjy/__init__.py 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/Lib/modjy/__init__.py 2009-10-21 01:58:03 UTC (rev 6887) @@ -1,22 +1,22 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -__all__ = ['modjy', 'modjy_exceptions', 'modjy_impl', 'modjy_log', 'modjy_params', 'modjy_publish', 'modjy_response', 'modjy_write', 'modjy_wsgi',] - +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +__all__ = ['modjy', 'modjy_exceptions', 'modjy_impl', 'modjy_log', 'modjy_params', 'modjy_publish', 'modjy_response', 'modjy_write', 'modjy_wsgi',] + Modified: branches/indy/Lib/modjy/modjy.py =================================================================== --- branches/indy/Lib/modjy/modjy.py 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/Lib/modjy/modjy.py 2009-10-21 01:58:03 UTC (rev 6887) @@ -1,121 +1,121 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import jarray -import synchronize -import sys -import types - -sys.add_package("javax.servlet") -sys.add_package("javax.servlet.http") -sys.add_package("org.python.core") - -from modjy_exceptions import * -from modjy_log import * -from modjy_params import modjy_param_mgr, modjy_servlet_params -from modjy_wsgi import modjy_wsgi -from modjy_response import start_response_object -from modjy_impl import modjy_impl -from modjy_publish import modjy_publisher - -from javax.servlet.http import HttpServlet - -class modjy_servlet(HttpServlet, modjy_publisher, modjy_wsgi, modjy_impl): - - def __init__(self): - HttpServlet.__init__(self) - - def do_param(self, name, value): - if name[:3] == 'log': - getattr(self.log, "set_%s" % name)(value) - else: - self.params[name] = value - - def process_param_container(self, param_container): - param_enum = param_container.getInitParameterNames() - while param_enum.hasMoreElements(): - param_name = param_enum.nextElement() - self.do_param(param_name, param_container.getInitParameter(param_name)) - - def get_params(self): - self.process_param_container(self.servlet_context) - self.process_param_container(self.servlet) - - def init(self, delegator): - self.servlet = delegator - self.servlet_context = self.servlet.getServletContext() - self.servlet_config = self.servlet.getServletConfig() - self.log = modjy_logger(self.servlet_context) - self.params = modjy_param_mgr(modjy_servlet_params) - self.get_params() - self.init_impl() - self.init_publisher() - import modjy_exceptions - self.exc_handler = getattr(modjy_exceptions, '%s_handler' % self.params['exc_handler'])() - - def service (self, req, resp): - wsgi_environ = {} - try: - self.dispatch_to_application(req, resp, wsgi_environ) - except ModjyException, mx: - self.log.error("Exception servicing request: %s" % str(mx)) - typ, value, tb = sys.exc_info()[:] - self.exc_handler.handle(req, resp, wsgi_environ, mx, (typ, value, tb) ) - - def get_j2ee_ns(self, req, resp): - return { - 'servlet': self.servlet, - 'servlet_context': self.servlet_context, - 'servlet_config': self.servlet_config, - 'request': req, - 'response': resp, - } - - def dispatch_to_application(self, req, resp, environ): - app_callable = self.get_app_object(req, environ) - self.set_wsgi_environment(req, resp, environ, self.params, self.get_j2ee_ns(req, resp)) - response_callable = start_response_object(req, resp) - try: - app_return = self.call_application(app_callable, environ, response_callable) - if app_return is None: - raise ReturnNotIterable("Application returned None: must return an iterable") - self.deal_with_app_return(environ, response_callable, app_return) - except ModjyException, mx: - self.raise_exc(mx.__class__, str(mx)) - except Exception, x: - self.raise_exc(ApplicationException, str(x)) - - def call_application(self, app_callable, environ, response_callable): - if self.params['multithread']: - return app_callable.__call__(environ, response_callable) - else: - return synchronize.apply_synchronized( \ - app_callable, \ - app_callable, \ - (environ, response_callable)) - - def expand_relative_path(self, path): - if path.startswith("$"): - return self.servlet.getServletContext().getRealPath(path[1:]) - return path - - def raise_exc(self, exc_class, message): - self.log.error(message) - raise exc_class(message) +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +import jarray +import synchronize +import sys +import types + +sys.add_package("javax.servlet") +sys.add_package("javax.servlet.http") +sys.add_package("org.python.core") + +from modjy_exceptions import * +from modjy_log import * +from modjy_params import modjy_param_mgr, modjy_servlet_params +from modjy_wsgi import modjy_wsgi +from modjy_response import start_response_object +from modjy_impl import modjy_impl +from modjy_publish import modjy_publisher + +from javax.servlet.http import HttpServlet + +class modjy_servlet(HttpServlet, modjy_publisher, modjy_wsgi, modjy_impl): + + def __init__(self): + HttpServlet.__init__(self) + + def do_param(self, name, value): + if name[:3] == 'log': + getattr(self.log, "set_%s" % name)(value) + else: + self.params[name] = value + + def process_param_container(self, param_container): + param_enum = param_container.getInitParameterNames() + while param_enum.hasMoreElements(): + param_name = param_enum.nextElement() + self.do_param(param_name, param_container.getInitParameter(param_name)) + + def get_params(self): + self.process_param_container(self.servlet_context) + self.process_param_container(self.servlet) + + def init(self, delegator): + self.servlet = delegator + self.servlet_context = self.servlet.getServletContext() + self.servlet_config = self.servlet.getServletConfig() + self.log = modjy_logger(self.servlet_context) + self.params = modjy_param_mgr(modjy_servlet_params) + self.get_params() + self.init_impl() + self.init_publisher() + import modjy_exceptions + self.exc_handler = getattr(modjy_exceptions, '%s_handler' % self.params['exc_handler'])() + + def service (self, req, resp): + wsgi_environ = {} + try: + self.dispatch_to_application(req, resp, wsgi_environ) + except ModjyException, mx: + self.log.error("Exception servicing request: %s" % str(mx)) + typ, value, tb = sys.exc_info()[:] + self.exc_handler.handle(req, resp, wsgi_environ, mx, (typ, value, tb) ) + + def get_j2ee_ns(self, req, resp): + return { + 'servlet': self.servlet, + 'servlet_context': self.servlet_context, + 'servlet_config': self.servlet_config, + 'request': req, + 'response': resp, + } + + def dispatch_to_application(self, req, resp, environ): + app_callable = self.get_app_object(req, environ) + self.set_wsgi_environment(req, resp, environ, self.params, self.get_j2ee_ns(req, resp)) + response_callable = start_response_object(req, resp) + try: + app_return = self.call_application(app_callable, environ, response_callable) + if app_return is None: + raise ReturnNotIterable("Application returned None: must return an iterable") + self.deal_with_app_return(environ, response_callable, app_return) + except ModjyException, mx: + self.raise_exc(mx.__class__, str(mx)) + except Exception, x: + self.raise_exc(ApplicationException, str(x)) + + def call_application(self, app_callable, environ, response_callable): + if self.params['multithread']: + return app_callable.__call__(environ, response_callable) + else: + return synchronize.apply_synchronized( \ + app_callable, \ + app_callable, \ + (environ, response_callable)) + + def expand_relative_path(self, path): + if path.startswith("$"): + return self.servlet.getServletContext().getRealPath(path[1:]) + return path + + def raise_exc(self, exc_class, message): + self.log.error(message) + raise exc_class(message) Modified: branches/indy/Lib/modjy/modjy_exceptions.py =================================================================== --- branches/indy/Lib/modjy/modjy_exceptions.py 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/Lib/modjy/modjy_exceptions.py 2009-10-21 01:58:03 UTC (rev 6887) @@ -1,91 +1,91 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import sys -import StringIO -import traceback - -from java.lang import IllegalStateException -from java.io import IOException -from javax.servlet import ServletException - -class ModjyException(Exception): pass - -class ModjyIOException(ModjyException): pass - -class ConfigException(ModjyException): pass -class BadParameter(ConfigException): pass -class ApplicationNotFound(ConfigException): pass -class NoCallable(ConfigException): pass - -class RequestException(ModjyException): pass - -class ApplicationException(ModjyException): pass -class StartResponseNotCalled(ApplicationException): pass -class StartResponseCalledTwice(ApplicationException): pass -class ResponseCommitted(ApplicationException): pass -class HopByHopHeaderSet(ApplicationException): pass -class WrongLength(ApplicationException): pass -class BadArgument(ApplicationException): pass -class ReturnNotIterable(ApplicationException): pass -class NonStringOutput(ApplicationException): pass - -class exception_handler: - - def handle(self, req, resp, environ, exc, exc_info): - pass - - def get_status_and_message(self, req, resp, exc): - return resp.SC_INTERNAL_SERVER_ERROR, "Server configuration error" - -# -# Special exception handler for testing -# - -class testing_handler(exception_handler): - - def handle(self, req, resp, environ, exc, exc_info): - typ, value, tb = exc_info - err_msg = StringIO.StringIO() - err_msg.write("%s: %s\n" % (typ, value,) ) - err_msg.write(">Environment\n") - for k in environ.keys(): - err_msg.write("%s=%s\n" % (k, repr(environ[k])) ) - err_msg.write("<Environment\n") - err_msg.write(">TraceBack\n") - for line in traceback.format_exception(typ, value, tb): - err_msg.write(line) - err_msg.write("<TraceBack\n") - try: - status, message = self.get_status_and_message(req, resp, exc) - resp.setStatus(status) - resp.setContentLength(len(err_msg.getvalue())) - resp.getOutputStream().write(err_msg.getvalue()) - except IllegalStateException, ise: - raise exc # Let the container deal with it - -# -# Standard exception handler -# - -class standard_handler(exception_handler): - - def handle(self, req, resp, environ, exc, exc_info): - raise exc_info[0], exc_info[1], exc_info[2] +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +import sys +import StringIO +import traceback + +from java.lang import IllegalStateException +from java.io import IOException +from javax.servlet import ServletException + +class ModjyException(Exception): pass + +class ModjyIOException(ModjyException): pass + +class ConfigException(ModjyException): pass +class BadParameter(ConfigException): pass +class ApplicationNotFound(ConfigException): pass +class NoCallable(ConfigException): pass + +class RequestException(ModjyException): pass + +class ApplicationException(ModjyException): pass +class StartResponseNotCalled(ApplicationException): pass +class StartResponseCalledTwice(ApplicationException): pass +class ResponseCommitted(ApplicationException): pass +class HopByHopHeaderSet(ApplicationException): pass +class WrongLength(ApplicationException): pass +class BadArgument(ApplicationException): pass +class ReturnNotIterable(ApplicationException): pass +class NonStringOutput(ApplicationException): pass + +class exception_handler: + + def handle(self, req, resp, environ, exc, exc_info): + pass + + def get_status_and_message(self, req, resp, exc): + return resp.SC_INTERNAL_SERVER_ERROR, "Server configuration error" + +# +# Special exception handler for testing +# + +class testing_handler(exception_handler): + + def handle(self, req, resp, environ, exc, exc_info): + typ, value, tb = exc_info + err_msg = StringIO.StringIO() + err_msg.write("%s: %s\n" % (typ, value,) ) + err_msg.write(">Environment\n") + for k in environ.keys(): + err_msg.write("%s=%s\n" % (k, repr(environ[k])) ) + err_msg.write("<Environment\n") + err_msg.write(">TraceBack\n") + for line in traceback.format_exception(typ, value, tb): + err_msg.write(line) + err_msg.write("<TraceBack\n") + try: + status, message = self.get_status_and_message(req, resp, exc) + resp.setStatus(status) + resp.setContentLength(len(err_msg.getvalue())) + resp.getOutputStream().write(err_msg.getvalue()) + except IllegalStateException, ise: + raise exc # Let the container deal with it + +# +# Standard exception handler +# + +class standard_handler(exception_handler): + + def handle(self, req, resp, environ, exc, exc_info): + raise exc_info[0], exc_info[1], exc_info[2] Modified: branches/indy/Lib/modjy/modjy_impl.py =================================================================== --- branches/indy/Lib/modjy/modjy_impl.py 2009-10-20 04:25:15 UTC (rev 6886) +++ branches/indy/Lib/modjy/modjy_impl.py 2009-10-21 01:58:03 UTC (rev 6887) @@ -1,101 +1,101 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import types -import sys - -from modjy_exceptions import * - -class modjy_impl: - - def deal_with_app_return(self, environ, start_response_callable, app_return): - self.log.debug("Processing app return type: %s" % str(type(app_return))) - if isinstance(app_return, types.StringTypes): - raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) - if type(app_return) is types.FileType: - pass # TBD: What to do here? can't call fileno() - if hasattr(app_return, '__len__') and callable(app_return.__len__): - expected_pieces = app_return.__len__() - else: - expected_pieces = -1 - try: - try: - ix = 0 - for next_piece in app_return: - if not isinstance(next_piece, types.StringTypes): - raise NonStringOutput("Application returned iterable containing non-strings: %s" % str(type(next_piece))) - if ix == 0: - # The application may have called start_response in the first iteration - if not start_response_callable.called: - raise StartResponseNotCalled("Start_response callable was never called.") - if not start_response_callable.content_length \ - and expected_pieces == 1 \ - and start_response_callable.write_callable.num_writes == 0: - # Take the length of the first piece - start_response_callable.set_content_length(len(next_piece)) - start_response_callable.write_callable(next_piece) - ix += 1 - if ix == expected_pieces: - break - if expected_pieces != -1 and ix != expected_pieces: - raise WrongLength("Iterator len() was wrong. Expected %d pieces: got %d" % (expected_pieces, ix) ) - except AttributeError, ax: - if str(ax) == "__getitem__": - raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) - else: - raise ax - except TypeError, tx: - raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) - except ModjyException, mx: - raise mx - except Exception, x: - raise ApplicationException(x) - finally: - if hasattr(app_return, 'close') and callable(app_return.close): - app_return.close() - - def init_impl(self): - self.do_j_env_params() - - def add_packages(self, package_list): - packages = [p.strip() for p in package_list.split(';')] - for p in packages: - self.log.info("Adding java package %s to jython" % p) - sys.add_package(p) - - def add_classdirs(self, classdir_list): - classdirs = [cd.strip() for cd in classdir_list.split(';')] - for cd in classdirs: - self.log.info("Adding directory %s to jython class file search path" % cd) - sys.add_classdir(cd) - - def add_extdirs(self, extdir_list): - extdirs = [ed.strip() for ed in extdir_list.split(';')] - for ed in extdirs: - self.log.info("Adding directory %s for .jars and .zips search path" % ed) - sys.add_extdir(self.expand_relative_path(ed)) - - def do_j_env_params(self): - if self.params['packages']: - self.add_packages(self.params['packages']) - if self.params['classdirs']: - self.add_classdirs(self.params['classdirs']) - if self.params['extdirs']: - self.add_extdirs(self.params['extdirs']) +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +import types +import sys + +from modjy_exceptions import * + +class modjy_impl: + + def deal_with_app_return(self, environ, start_response_callable, app_return): + self.log.debug("Processing app return type: %s" % str(type(app_return))) + if isinstance(app_return, types.StringTypes): + raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) + if type(app_return) is types.FileType: + pass # TBD: What to do here? can't call fileno() + if hasattr(app_return, '__len__') and callable(app_return.__len__): + expected_pieces = app_return.__len__() + else: + expected_pieces = -1 + try: + try: + ix = 0 + for next_piece in app_return: + if not isinstance(next_piece, types.StringTypes): + raise NonStringOutput("Application returned iterable containing non-strings: %s" % str(type(next_piece))) + if ix == 0: + # The application may have called start_response in the first iteration + if not start_response_callable.called: + raise StartResponseNotCalled("Start_response callable was never called.") + if not start_response_callable.content_length \ + and expected_pieces == 1 \ + and start_response_callable.write_callable.num_writes == 0: + # Take the length of the first piece + start_response_callable.set_content_length(len(next_piece)) + start_response_callable.write_callable(next_piece) + ix += 1 ... [truncated message content] |
From: <pj...@us...> - 2009-10-20 04:25:23
|
Revision: 6886 http://jython.svn.sourceforge.net/jython/?rev=6886&view=rev Author: pjenvey Date: 2009-10-20 04:25:15 +0000 (Tue, 20 Oct 2009) Log Message: ----------- don't decode bytes when searching for an encoding defined in an InputStream thanks artichoke fixes #1487 Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/core/ParserFacade.java Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2009-10-20 04:24:54 UTC (rev 6885) +++ trunk/jython/NEWS 2009-10-20 04:25:15 UTC (rev 6886) @@ -3,6 +3,7 @@ Jython 2.5.2a1 Bugs Fixed - [ 1478 ] defaultdict & weakref.WeakKeyDictionary [TypeError: first argument must be callable] + - [ 1487 ] Import of module with latin-1 chars fails on utf-8 file encoding - Fix runtime issues during exitfuncs triggered via SystemRestart (such as during Django or Pylons development mode reloading) Modified: trunk/jython/src/org/python/core/ParserFacade.java =================================================================== --- trunk/jython/src/org/python/core/ParserFacade.java 2009-10-20 04:24:54 UTC (rev 6885) +++ trunk/jython/src/org/python/core/ParserFacade.java 2009-10-20 04:25:15 UTC (rev 6886) @@ -4,14 +4,11 @@ import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.OutputStreamWriter; import java.io.Reader; import java.io.StringReader; -import java.io.Writer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; @@ -25,7 +22,6 @@ import org.python.antlr.BaseParser; import org.python.antlr.NoCloseReaderStream; import org.python.antlr.ParseException; -import org.python.antlr.PythonLexer; import org.python.antlr.PythonPartialLexer; import org.python.antlr.PythonPartialParser; import org.python.antlr.PythonTokenSource; @@ -387,7 +383,7 @@ private static String readEncoding(InputStream stream) throws IOException { stream.mark(MARK_LIMIT); String encoding = null; - BufferedReader br = new BufferedReader(new InputStreamReader(stream), 512); + BufferedReader br = new BufferedReader(new InputStreamReader(stream, "ISO-8859-1"), 512); encoding = findEncoding(br); // XXX: reset() can still raise an IOException if a line exceeds our large mark // limit This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-20 04:25:03
|
Revision: 6885 http://jython.svn.sourceforge.net/jython/?rev=6885&view=rev Author: pjenvey Date: 2009-10-20 04:24:54 +0000 (Tue, 20 Oct 2009) Log Message: ----------- fix missing imports and reference to now fixed os.__name__ Modified Paths: -------------- trunk/jython/Lib/posix.py trunk/jython/Lib/test/test_import_jy.py Modified: trunk/jython/Lib/posix.py =================================================================== --- trunk/jython/Lib/posix.py 2009-10-20 04:04:53 UTC (rev 6884) +++ trunk/jython/Lib/posix.py 2009-10-20 04:24:54 UTC (rev 6885) @@ -278,11 +278,12 @@ FileIO(filename, 'w').close() if exclusive and creating: + from java.io import IOException try: if not File(sys.getPath(filename)).createNewFile(): raise OSError(errno.EEXIST, strerror(errno.EEXIST), filename) - except java.io.IOException, ioe: + except IOException, ioe: raise OSError(ioe) mode = '%s%s%s%s' % (reading and 'r' or '', @@ -541,6 +542,7 @@ rawio = FileDescriptors.get(fd) rawio.checkClosed() + from java.io import IOException from java.nio.channels import FileChannel channel = rawio.getChannel() if not isinstance(channel, FileChannel): @@ -548,7 +550,7 @@ try: channel.force(metadata) - except java.io.IOException, ioe: + except IOException, ioe: raise OSError(ioe) def getpid(): Modified: trunk/jython/Lib/test/test_import_jy.py =================================================================== --- trunk/jython/Lib/test/test_import_jy.py 2009-10-20 04:04:53 UTC (rev 6884) +++ trunk/jython/Lib/test/test_import_jy.py 2009-10-20 04:24:54 UTC (rev 6885) @@ -100,10 +100,8 @@ def test_override(self): modname = os.path.__name__ tests = [ - ("import os.path" , "('os.path', None, -1, '_%s')" - % os._name), - ("import os.path as path2", "('os.path', None, -1, '_%s')" - % os._name), + ("import os.path" , "('os.path', None, -1, 'os')"), + ("import os.path as path2", "('os.path', None, -1, 'os')"), ("from os.path import *" , "('os.path', ('*',), -1, '%s')" % modname), ("from os.path import join", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-20 04:05:02
|
Revision: 6884 http://jython.svn.sourceforge.net/jython/?rev=6884&view=rev Author: pjenvey Date: 2009-10-20 04:04:53 +0000 (Tue, 20 Oct 2009) Log Message: ----------- move _exit/listdir to PosixModule, get rid of a duplicate getlogin impl Modified Paths: -------------- trunk/jython/Lib/posix.py trunk/jython/src/org/python/modules/posix/PosixModule.java Modified: trunk/jython/Lib/posix.py =================================================================== --- trunk/jython/Lib/posix.py 2009-10-20 03:43:46 UTC (rev 6883) +++ trunk/jython/Lib/posix.py 2009-10-20 04:04:53 UTC (rev 6884) @@ -12,20 +12,18 @@ from _nt import * import errno import jarray -import java.lang.System import stat as _stat import sys from java.io import File from org.python.core.io import FileDescriptors, FileIO, IOBase from org.python.core.Py import newString as asPyString -__all__ = _posix.__all__[:] -__all__.extend(['_exit', 'access', 'chdir', 'chmod', 'close', 'fdopen', - 'fsync', 'ftruncate', 'getcwd', 'getcwdu', 'getenv', 'getpid', - 'isatty', 'listdir', 'lseek', 'mkdir', 'open', 'popen', - 'putenv', 'read', 'remove', 'rename', 'rmdir', 'system', - 'umask', 'unlink', 'unsetenv', 'urandom', 'utime', - 'write']) +__all__ = [name for name in _posix.__all__ if not name.startswith('__doc__')] +__all__.extend(['access', 'chdir', 'chmod', 'close', 'fdopen', 'fsync', + 'ftruncate', 'getcwd', 'getcwdu', 'getenv', 'getpid', 'isatty', + 'lseek', 'mkdir', 'open', 'popen', 'putenv', 'read', 'remove', + 'rename', 'rmdir', 'system', 'umask', 'unlink', 'unsetenv', + 'urandom', 'utime', 'write']) _name = _posix.__name__[1:] @@ -38,14 +36,6 @@ # Lazily loaded path module _path = None -def _exit(n=0): - """_exit(status) - - Exit to the system with specified status, without normal exit - processing. - """ - java.lang.System.exit(n) - def getcwd(): """getcwd() -> path @@ -73,21 +63,6 @@ _path = os.path sys.setCurrentWorkingDir(_path.realpath(path)) -def listdir(path): - """listdir(path) -> list_of_strings - - Return a list containing the names of the entries in the directory. - - path: path of directory to list - - The list is in arbitrary order. It does not include the special - entries '.' and '..' even if they are present in the directory. - """ - l = File(sys.getPath(path)).list() - if l is None: - raise OSError(0, 'No such directory', path) - return [asPyString(entry) for entry in l] - def chmod(path, mode): """chmod(path, mode) @@ -399,13 +374,6 @@ def __iter__(self): return iter(self._stream) -def getlogin(): - """getlogin() -> string - - Return the actual login name. - """ - return java.lang.System.getProperty("user.name") - def putenv(key, value): """putenv(key, value) Modified: trunk/jython/src/org/python/modules/posix/PosixModule.java =================================================================== --- trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-20 03:43:46 UTC (rev 6883) +++ trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-20 04:04:53 UTC (rev 6884) @@ -17,13 +17,14 @@ import org.python.core.PyObject; import org.python.core.PyString; import org.python.core.PyTuple; +import org.python.core.util.RelativeFile; /** * The underlying _posix or _nt module, named depending on the platform. * * This currently contains only some of the basics of the posix/nt modules (which are - * implemented in Python). In particular things like the PythonPOSIXHandler that are - * slower to instantiate and thus would affect startup time. + * implemented in Python), most importantly things like PythonPOSIXHandler that are slower + * to instantiate and thus would affect startup time. * * Eventually more if not all of the pure Python module should end up here. */ @@ -42,9 +43,6 @@ private static POSIX posix = POSIXFactory.getPOSIX(new PythonPOSIXHandler(), true); public static void classDictInit(PyObject dict) { - dict.__setitem__("__name__", new PyString("_" + os.getModuleName())); - dict.__setitem__("__doc__", __doc__); - // os.open flags, only expose what we support dict.__setitem__("O_RDONLY", Py.newInteger(0x0)); dict.__setitem__("O_WRONLY", Py.newInteger(0x1)); @@ -75,13 +73,46 @@ dict.__setitem__("getOSName", null); dict.__setitem__("__all__", dict.invoke("keys")); + + dict.__setitem__("__name__", new PyString("_" + os.getModuleName())); + dict.__setitem__("__doc__", __doc__); } + public static PyString __doc___exit = new PyString( + "_exit(status)\n\n" + + "Exit to the system with specified status, without normal exit processing."); + public static void _exit() { + _exit(0); + } + + public static void _exit(int status) { + System.exit(status); + } + + public static PyString __doc__listdir = new PyString( + "listdir(path) -> list_of_strings\n\n" + + "Return a list containing the names of the entries in the directory.\n\n" + + "path: path of directory to list\n\n" + + "The list is in arbitrary order. It does not include the special\n" + + "entries '.' and '..' even if they are present in the directory."); + public static PyList listdir(String path) { + PyList list = new PyList(); + String[] files = new RelativeFile(path).list(); + + if (files == null) { + throw Py.OSError("No such directory: " + path); + } + for (String file : files) { + list.append(new PyString(file)); + } + return list; + } + public static PyString __doc__lstat = new PyString( "lstat(path) -> stat result\n\n" + "Like stat(path), but do not follow symbolic links."); public static PyObject lstat(String path) { - return PyStatResult.fromFileStat(posix.lstat(Py.getSystemState().getPath(path))); + return PyStatResult.fromFileStat(posix.lstat(new RelativeFile(path).getPath())); } public static PyString __doc__stat = new PyString( @@ -90,11 +121,11 @@ "Note that some platforms may return only a small subset of the\n" + "standard fields"); public static PyObject stat(String path) { - return PyStatResult.fromFileStat(posix.stat(Py.getSystemState().getPath(path))); + return PyStatResult.fromFileStat(posix.stat(new RelativeFile(path).getPath())); } public static PyString __doc__strerror = new PyString( - "strerror(code) -> string\n\n" + + "strerror(code) -> string\n\n" + "Translate an error code to a message string."); public static PyObject strerror(int code) { Constant errno = Errno.valueOf(code); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-20 03:43:55
|
Revision: 6883 http://jython.svn.sourceforge.net/jython/?rev=6883&view=rev Author: pjenvey Date: 2009-10-20 03:43:46 +0000 (Tue, 20 Oct 2009) Log Message: ----------- identify reflected funcs as routines so they can show up in help() Modified Paths: -------------- trunk/jython/Lib/inspect.py Added Paths: ----------- trunk/jython/Lib/test/test_inspect_jy.py Modified: trunk/jython/Lib/inspect.py =================================================================== --- trunk/jython/Lib/inspect.py 2009-10-20 03:28:30 UTC (rev 6882) +++ trunk/jython/Lib/inspect.py 2009-10-20 03:43:46 UTC (rev 6883) @@ -30,6 +30,7 @@ import sys, os, types, string, re, dis, imp, tokenize, linecache from operator import attrgetter +ReflectedFunctionType = type(os.listdir) # ----------------------------------------------------------- type-checking def ismodule(object): @@ -196,7 +197,8 @@ return (isbuiltin(object) or isfunction(object) or ismethod(object) - or ismethoddescriptor(object)) + or ismethoddescriptor(object) + or isinstance(object, ReflectedFunctionType)) def getmembers(object, predicate=None): """Return all members of an object as (name, value) pairs sorted by name. Added: trunk/jython/Lib/test/test_inspect_jy.py =================================================================== --- trunk/jython/Lib/test/test_inspect_jy.py (rev 0) +++ trunk/jython/Lib/test/test_inspect_jy.py 2009-10-20 03:43:46 UTC (rev 6883) @@ -0,0 +1,21 @@ +"""Misc inspect tests + +Made for Jython. +""" +import inspect +import unittest +from java.lang import System +from test import test_support + +class InspectTestCase(unittest.TestCase): + + def test_java_routine(self): + self.assertTrue(inspect.isroutine(System.arraycopy)) + + +def test_main(): + test_support.run_unittest(InspectTestCase) + + +if __name__ == '__main__': + test_main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-20 03:28:41
|
Revision: 6882 http://jython.svn.sourceforge.net/jython/?rev=6882&view=rev Author: pjenvey Date: 2009-10-20 03:28:30 +0000 (Tue, 20 Oct 2009) Log Message: ----------- only import these when necessary Modified Paths: -------------- trunk/jython/Lib/ntpath.py trunk/jython/Lib/posixpath.py Modified: trunk/jython/Lib/ntpath.py =================================================================== --- trunk/jython/Lib/ntpath.py 2009-10-20 01:20:43 UTC (rev 6881) +++ trunk/jython/Lib/ntpath.py 2009-10-20 03:28:30 UTC (rev 6882) @@ -5,11 +5,9 @@ module as os.path. """ -import java.io.File import os import stat import sys -from org.python.core.Py import newString __all__ = ["normcase","isabs","join","splitdrive","split","splitext", "basename","dirname","commonprefix","getsize","getmtime", @@ -487,6 +485,9 @@ from nt import _getfullpathname except ImportError: # not running on Windows - mock up something sensible + import java.io.File + from org.python.core.Py import newString + def abspath(path): """Return the absolute version of a path.""" if not isabs(path): Modified: trunk/jython/Lib/posixpath.py =================================================================== --- trunk/jython/Lib/posixpath.py 2009-10-20 01:20:43 UTC (rev 6881) +++ trunk/jython/Lib/posixpath.py 2009-10-20 03:28:30 UTC (rev 6882) @@ -10,11 +10,8 @@ for manipulation of the pathname component of URLs. """ -import java.io.File -import java.io.IOException import os import stat -from org.python.core.Py import newString __all__ = ["normcase","isabs","join","splitdrive","split","splitext", "basename","dirname","commonprefix","getsize","getmtime", @@ -217,6 +214,10 @@ # Are two filenames really pointing to the same file? if not os._native_posix: + import java.io.File + import java.io.IOException + from org.python.core.Py import newString + def samefile(f1, f2): """Test whether two pathnames reference the same actual file""" canon1 = newString(java.io.File(_ensure_str(f1)).getCanonicalPath()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-20 01:20:54
|
Revision: 6881 http://jython.svn.sourceforge.net/jython/?rev=6881&view=rev Author: pjenvey Date: 2009-10-20 01:20:43 +0000 (Tue, 20 Oct 2009) Log Message: ----------- avoid the types import Modified Paths: -------------- trunk/jython/Lib/site.py Modified: trunk/jython/Lib/site.py =================================================================== --- trunk/jython/Lib/site.py 2009-10-20 01:15:51 UTC (rev 6880) +++ trunk/jython/Lib/site.py 2009-10-20 01:20:43 UTC (rev 6881) @@ -60,8 +60,8 @@ import sys import os -import types import __builtin__ +ModuleType = type(os) def makepath(*paths): @@ -74,7 +74,7 @@ def abs__file__(): """Set all module' __file__ attribute to an absolute path""" for m in sys.modules.values(): - if not isinstance(m, types.ModuleType) or hasattr(m, '__loader__'): + if not isinstance(m, ModuleType) or hasattr(m, '__loader__'): # only modules need the abspath in Jython. and don't mess # with a PEP 302-supplied __file__ continue This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2009-10-20 01:16:03
|
Revision: 6880 http://jython.svn.sourceforge.net/jython/?rev=6880&view=rev Author: pjenvey Date: 2009-10-20 01:15:51 +0000 (Tue, 20 Oct 2009) Log Message: ----------- move the environ dict into the more appropriate PosixModule Modified Paths: -------------- trunk/jython/Lib/posix.py trunk/jython/src/org/python/core/PySystemState.java trunk/jython/src/org/python/modules/posix/PosixModule.java Modified: trunk/jython/Lib/posix.py =================================================================== --- trunk/jython/Lib/posix.py 2009-10-20 00:54:00 UTC (rev 6879) +++ trunk/jython/Lib/posix.py 2009-10-20 01:15:51 UTC (rev 6880) @@ -20,11 +20,11 @@ from org.python.core.Py import newString as asPyString __all__ = _posix.__all__[:] -__all__.extend(['_exit', 'access', 'chdir', 'chmod', 'close', 'environ', - 'fdopen', 'fsync', 'ftruncate', 'getcwd', 'getcwdu', 'getenv', - 'getpid', 'isatty', 'listdir', 'lseek', 'mkdir', 'open', - 'popen', 'putenv', 'read', 'remove', 'rename', 'rmdir', - 'system', 'umask', 'unlink', 'unsetenv', 'urandom', 'utime', +__all__.extend(['_exit', 'access', 'chdir', 'chmod', 'close', 'fdopen', + 'fsync', 'ftruncate', 'getcwd', 'getcwdu', 'getenv', 'getpid', + 'isatty', 'listdir', 'lseek', 'mkdir', 'open', 'popen', + 'putenv', 'read', 'remove', 'rename', 'rmdir', 'system', + 'umask', 'unlink', 'unsetenv', 'urandom', 'utime', 'write']) _name = _posix.__name__[1:] @@ -406,8 +406,6 @@ """ return java.lang.System.getProperty("user.name") -environ = sys.getEnviron() - def putenv(key, value): """putenv(key, value) Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2009-10-20 00:54:00 UTC (rev 6879) +++ trunk/jython/src/org/python/core/PySystemState.java 2009-10-20 01:15:51 UTC (rev 6880) @@ -125,8 +125,6 @@ private String currentWorkingDir; - private PyObject environ; - private ClassLoader classLoader = null; public PyObject stdout, stderr, stdin; @@ -165,7 +163,6 @@ path_importer_cache = new PyDictionary(); currentWorkingDir = new File("").getAbsolutePath(); - initEnviron(); // Set up the initial standard ins and outs String mode = Options.unbuffered ? "b" : ""; @@ -437,27 +434,6 @@ } /** - * Initialize the environ dict from System.getenv. environ may be empty when the - * security policy doesn't grant us access. - */ - public void initEnviron() { - environ = new PyDictionary(); - Map<String, String> env; - try { - env = System.getenv(); - } catch (SecurityException se) { - return; - } - for (Map.Entry<String, String> entry : env.entrySet()) { - environ.__setitem__(Py.newString(entry.getKey()), Py.newString(entry.getValue())); - } - } - - public PyObject getEnviron() { - return environ; - } - - /** * Change the current working directory to the specified path. * * path is assumed to be absolute and canonical (via Modified: trunk/jython/src/org/python/modules/posix/PosixModule.java =================================================================== --- trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-20 00:54:00 UTC (rev 6879) +++ trunk/jython/src/org/python/modules/posix/PosixModule.java 2009-10-20 01:15:51 UTC (rev 6880) @@ -4,12 +4,15 @@ import com.kenai.constantine.Constant; import com.kenai.constantine.platform.Errno; +import java.util.Map; + import org.jruby.ext.posix.JavaPOSIX; import org.jruby.ext.posix.POSIX; import org.jruby.ext.posix.POSIXFactory; import org.python.core.ClassDictInit; import org.python.core.Py; +import org.python.core.PyDictionary; import org.python.core.PyList; import org.python.core.PyObject; import org.python.core.PyString; @@ -60,6 +63,7 @@ // Successful termination dict.__setitem__("EX_OK", Py.Zero); + dict.__setitem__("environ", getEnviron()); dict.__setitem__("error", Py.OSError); dict.__setitem__("stat_result", PyStatResult.TYPE); dict.__setitem__("_posix_impl", Py.java2py(posix)); @@ -126,6 +130,24 @@ return new PyTuple(commandsTup); } + /** + * Initialize the environ dict from System.getenv. environ may be empty when the + * security policy doesn't grant us access. + */ + private static PyObject getEnviron() { + PyObject environ = new PyDictionary(); + Map<String, String> env; + try { + env = System.getenv(); + } catch (SecurityException se) { + return environ; + } + for (Map.Entry<String, String> entry : env.entrySet()) { + environ.__setitem__(Py.newString(entry.getKey()), Py.newString(entry.getValue())); + } + return environ; + } + public static POSIX getPOSIX() { return posix; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |