From: <cg...@us...> - 2009-08-16 08:11:57
|
Revision: 6675 http://jython.svn.sourceforge.net/jython/?rev=6675&view=rev Author: cgroves Date: 2009-08-16 08:11:44 +0000 (Sun, 16 Aug 2009) Log Message: ----------- Have lookup call through to lookup_where rather than duplicating the lookup functionality 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-08-16 03:04:08 UTC (rev 6674) +++ trunk/jython/src/org/python/core/PyType.java 2009-08-16 08:11:44 UTC (rev 6675) @@ -90,6 +90,9 @@ /** Mapping of Java classes to their TypeBuilders. */ private static Map<Class<?>, TypeBuilder> classToBuilder; + /** Used by {@link #lookup} to call {@link #lookup_where} without allocating an array */ + private static final PyObject[] WHERE_PLACEHOLDER = new PyObject[1]; + protected PyType(PyType subtype) { super(subtype); } @@ -1043,20 +1046,7 @@ * @return found object or null */ public PyObject lookup(String name) { - PyObject[] mro = this.mro; - if (mro == null) { - return null; - } - for (PyObject element : mro) { - PyObject dict = element.fastGetDict(); - if (dict != null) { - PyObject obj = dict.__finditem__(name); - if (obj != null) { - return obj; - } - } - } - return null; + return lookup_where(name, WHERE_PLACEHOLDER); } public PyObject lookup_where(String name, PyObject[] where) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |