Message1310

Author leouserz
Recipients
Date 2007-01-15.14:20:25
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The code in question is:
def vereq(a, b):

    if not (a == b):

        raise TestFailed, "%r == %r" % (a, b)


def descrdoc():
    if verbose: print "Testing descriptor doc strings..."
    def check(descr, what):
        vereq(descr.__doc__, what)
    check(file.closed, "True if the file is closed") # getset descriptor
    check(file.name, "file name") # member descriptor

What's worse is that this explodes in the jython interpreter:
java.lang.NullPointerException
        at org.python.core.PyObject.getDoc(PyObject.java:360)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.python.core.PyGetSetDescr.__get__(PyGetSetDescr.java:55)
        at org.python.core.PyObject.object___findattr__(PyObject.java:2770)
        at org.python.core.PyObject.__findattr__(PyObject.java:1044)
        at org.python.core.PyObject.__getattr__(PyObject.java:1081)
        at org.python.pycode._pyx2.f$0(<console>:1)
        at org.python.pycode._pyx2.call_function(<console>)
        at org.python.core.PyTableCode.call(PyTableCode.java:213)
        at org.python.core.PyCode.call(PyCode.java:14)
        at org.python.core.Py.runCode(Py.java:1182)
        at org.python.core.Py.exec(Py.java:1204)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:148)
        at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:88)
        at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:69)
        at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:44)
        at org.python.util.InteractiveConsole.push(InteractiveConsole.java:83)
        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:62)
        at org.python.util.jython.main(jython.java:214)

As to the description as to what to do about getting the __doc__ strings, it appears to make sense.  There just isn't any __doc__ strings that I can see that are in the PyFile class. :(
History
Date User Action Args
2008-02-20 17:17:36adminlinkissue1604250 messages
2008-02-20 17:17:36admincreate