Message9945

Author jmadden
Recipients jmadden, stefan.richthofer
Date 2015-04-23.23:36:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429832173.45.0.691675621157.issue2337@psf.upfronthosting.co.za>
In-reply-to
Content
I just finished testing a (simpler?) change that corrects both my test case and the original issue; basically the idea is to detect the circular nature of the Node structure and stop when you loop around:

diff -r 95d09ba14aa7 src/org/python/modules/_collections/PyDeque.java
--- a/src/org/python/modules/_collections/PyDeque.java	Wed Apr 15 18:34:17 2015 -0400
+++ b/src/org/python/modules/_collections/PyDeque.java	Thu Apr 23 18:33:08 2015 -0500
@@ -702,7 +702,7 @@


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

     @Override
History
Date User Action Args
2015-04-23 23:36:13jmaddensetmessageid: <1429832173.45.0.691675621157.issue2337@psf.upfronthosting.co.za>
2015-04-23 23:36:13jmaddensetrecipients: + jmadden, stefan.richthofer
2015-04-23 23:36:13jmaddenlinkissue2337 messages
2015-04-23 23:36:13jmaddencreate