Message9941

Author stefan.richthofer
Recipients jmadden, stefan.richthofer
Date 2015-04-23.22:55:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429829742.05.0.415697574396.issue2337@psf.upfronthosting.co.za>
In-reply-to
Content
The thing with PyDequeue makes sense. I actually contradicted my own warnings there and traversed java-objects. I thought I had done it in a safe way, but obviously I was wrong. Try the following fix:

Replace lines 680 onwards of PyDequeue.java with the following code (i.e. such that traverseNode won't be used and replaced by gc.traverseByReflection):


        /* Traverseproc implementation */
        @Override
        public int traverse(Visitproc visit, Object arg) {
            int retVal = super.traverse(visit, arg);
            if (retVal != 0) {
                return retVal;
            }
            //return lastReturned == null ? 0 : traverseNode(lastReturned, visit, arg);
            return lastReturned == null ? 0 :
                    gc.traverseByReflection(lastReturned, visit, arg)
        }

        @Override
        public boolean refersDirectlyTo(PyObject ob) throws UnsupportedOperationException {
            if (ob == null) {
                return false;
            } else if (super.refersDirectlyTo(ob)) {
                return true;
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }


    /* Traverseproc implementation */
//    private static int traverseNode(Node node, Visitproc visit, Object arg) {
//        int retVal;
//        if (node.data != null) {
//            retVal = visit.visit(node.data, arg);
//            if (retVal != 0) {
//                return retVal;
//            }
//        }
//        if (node.left != null) {
//            retVal = traverseNode(node.left, visit, arg);
//            if (retVal != 0) {
//                return retVal;
//            }
//        }
//        return node.right == null ? 0 : traverseNode(node.right, visit, arg);
//    }

    @Override
    public int traverse(Visitproc visit, Object arg) {
        //return header == null ? 0 : traverseNode(header, visit, arg);
        return header == null ? 0 : gc.traverseByReflection(header, visit, arg);
    }

    @Override
    public boolean refersDirectlyTo(PyObject ob) throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }
}




--------------

I left removes out-commented so you can better see what was actually changed. gc.traverseByReflection should be safe I suppose. If this cures the bug, we can merge it in, but you must confirm this first, as you are currently the only person able to reproduce this error.
History
Date User Action Args
2015-04-23 22:55:42stefan.richthofersetmessageid: <1429829742.05.0.415697574396.issue2337@psf.upfronthosting.co.za>
2015-04-23 22:55:42stefan.richthofersetrecipients: + stefan.richthofer, jmadden
2015-04-23 22:55:42stefan.richthoferlinkissue2337 messages
2015-04-23 22:55:41stefan.richthofercreate