From: <pj...@us...> - 2009-04-05 02:33:04
|
Revision: 6162 http://jython.svn.sourceforge.net/jython/?rev=6162&view=rev Author: pjenvey Date: 2009-04-05 02:32:50 +0000 (Sun, 05 Apr 2009) Log Message: ----------- remove the _new.classobj hack now that PyClass __new__ does the right thing Modified Paths: -------------- trunk/jython/Lib/new.py trunk/jython/src/org/python/modules/Setup.java Removed Paths: ------------- trunk/jython/src/org/python/modules/_newmodule.java Modified: trunk/jython/Lib/new.py =================================================================== --- trunk/jython/Lib/new.py 2009-04-05 01:53:25 UTC (rev 6161) +++ trunk/jython/Lib/new.py 2009-04-05 02:32:50 UTC (rev 6162) @@ -4,10 +4,7 @@ Objects of most types can now be created by calling the type object. """ -# XXX: Hack for types.ClassType not supporting creation of new style -# classes; see org.python.modules._newmodule.classobj for more info -#from types import ClassType as classobj -from _new import classobj +from types import ClassType as classobj from types import FunctionType as function from types import InstanceType as instance from types import MethodType as instancemethod Modified: trunk/jython/src/org/python/modules/Setup.java =================================================================== --- trunk/jython/src/org/python/modules/Setup.java 2009-04-05 01:53:25 UTC (rev 6161) +++ trunk/jython/src/org/python/modules/Setup.java 2009-04-05 02:32:50 UTC (rev 6162) @@ -41,7 +41,6 @@ "_codecs", "imp", "ucnhash", - "_new:org.python.modules._newmodule", "_weakref:org.python.modules._weakref.WeakrefModule", "errno", "array:org.python.modules.ArrayModule", Deleted: trunk/jython/src/org/python/modules/_newmodule.java =================================================================== --- trunk/jython/src/org/python/modules/_newmodule.java 2009-04-05 01:53:25 UTC (rev 6161) +++ trunk/jython/src/org/python/modules/_newmodule.java 2009-04-05 02:32:50 UTC (rev 6162) @@ -1,38 +0,0 @@ -/* Copyright (c) 2001, 2003 Finn Bock, Samuele Pedroni */ -package org.python.modules; - -import org.python.core.ClassDictInit; -import org.python.core.Py; -import org.python.core.PyClass; -import org.python.core.PyObject; -import org.python.core.PyTuple; -import org.python.core.PyType; - -/** - * The internal new module; just provides a hack for new.classobj. - * - */ -public class _newmodule implements ClassDictInit { - - public static void classDictInit(PyObject dict) - { - dict.__setitem__("__name__", Py.newString("_new")); - } - - public static PyObject classobj(String name, PyTuple bases, PyObject dict) { - // XXX: Hack to return new style classes (originally from - // r4225). types.ClassType (PyClass) should be doing this - // instead, but it needs to be new style so it can return new - // style classes via __new__. When that happens we can use the - // pure python new.py completely - // XXX: This workaround can't be done in new.py (pure python) - // because the caller's stack frame would be wrong (which is - // used to determine the new class's __module__) - for (PyObject base : bases.getArray()) { - if (base instanceof PyType) { - return base.getType().__call__(Py.newString(name), bases, dict); - } - } - return Py.makeClass(name, bases.getArray(), dict); - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |