From: brian z. <bz...@us...> - 2005-02-26 22:00:02
|
Update of /cvsroot/jython/jython/org/python/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8385/org/python/core Modified Files: PyBuiltinFunction.java Log Message: expose self Index: PyBuiltinFunction.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyBuiltinFunction.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -d -r2.1 -r2.2 *** PyBuiltinFunction.java 22 Feb 2005 04:19:30 -0000 2.1 --- PyBuiltinFunction.java 26 Feb 2005 21:59:51 -0000 2.2 *************** *** 1,5 **** package org.python.core; ! public abstract class PyBuiltinFunction extends PyObject { public interface Info { --- 1,18 ---- package org.python.core; ! public abstract class PyBuiltinFunction extends PyObject implements PyType.Newstyle { ! ! /* type info */ ! ! public static final String exposed_name="builtin_function_or_method"; ! ! public static void typeSetup(PyObject dict,PyType.Newstyle marker) { ! dict.__setitem__("__name__", new PyGetSetDescr("__name__", ! PyBuiltinFunction.class, "fastGetName", null)); ! dict.__setitem__("__self__", new PyGetSetDescr("__self__", ! PyBuiltinFunction.class, "getSelf", null)); ! dict.__setitem__("__doc__", new PyGetSetDescr("__doc__", ! PyBuiltinFunction.class, "fastGetDoc", null)); ! } public interface Info { *************** *** 11,15 **** public static class DefaultInfo implements Info { ! public DefaultInfo(String name,int minargs,int maxargs) { this.name = name; --- 24,28 ---- public static class DefaultInfo implements Info { ! public DefaultInfo(String name,int minargs,int maxargs) { this.name = name; *************** *** 35,39 **** return minargs; } ! public static boolean check(int nargs,int minargs,int maxargs) { if (nargs < minargs) --- 48,52 ---- return minargs; } ! public static boolean check(int nargs,int minargs,int maxargs) { if (nargs < minargs) *************** *** 43,47 **** return true; } ! public static PyException unexpectedCall( int nargs, --- 56,60 ---- return true; } ! public static PyException unexpectedCall( int nargs, *************** *** 64,68 **** minargs + " (" + nargs + " given)"); } else { ! if (minargs <= 0) argsblurb = "at most "+ maxargs + " argumens"; else --- 77,81 ---- minargs + " (" + nargs + " given)"); } else { ! if (minargs <= 0) argsblurb = "at most "+ maxargs + " argumens"; else *************** *** 77,81 **** return unexpectedCall(nargs, keywords, name, minargs, maxargs); } ! } --- 90,94 ---- return unexpectedCall(nargs, keywords, name, minargs, maxargs); } ! } *************** *** 94,98 **** abstract protected PyBuiltinFunction makeBound(PyObject self); ! protected PyObject getSelf() { return null; } --- 107,111 ---- abstract protected PyBuiltinFunction makeBound(PyObject self); ! public PyObject getSelf() { return null; } *************** *** 110,114 **** + " object>"; } - } --- 123,126 ---- *************** *** 136,138 **** --- 148,157 ---- String[] keywords); + public PyObject fastGetName() { + return Py.newString(this.info.getName()); + } + + public PyObject fastGetDoc() { + return Py.None; + } } |