From 9b98e161251e6d57205ff95ea19c2f07737f80da Mon Sep 17 00:00:00 2001
From: Chong Yidong <cyd@stupidchicken.com>
Date: Wed, 14 Dec 2005 20:49:46 +0000
Subject: [PATCH] * print.c (print_preprocess): Go to a deeper print_depth to
 avoid 	print_object loop.

---
 src/ChangeLog | 6 ++++++
 src/print.c   | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 90d782faa20..b26416b7839 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,13 @@
+2005-12-14  Chong Yidong  <cyd@stupidchicken.com>
+
+	* print.c (print_preprocess): Go to a deeper print_depth to avoid
+	print_object loop.
+
 2005-12-14  Kyotaro HORIGUCHI  <horiguti@meadowy.org>  (tiny change)
 
 	* coding.c (code_convert_region_unwind): GCPRO arg.
 
+>>>>>>> 1.4762
 2005-12-12  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* xfns.c (compute_tip_xy): Calculate root_y the same way as root_x,
diff --git a/src/print.c b/src/print.c
index d563580ddd3..ed6b402763a 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1313,7 +1313,13 @@ print_preprocess (obj)
 
   /* Give up if we go so deep that print_object will get an error.  */
   /* See similar code in print_object.  */
-  if (print_depth >= PRINT_CIRCLE)
+  /* Because print_preprocess "follows" nested lists in a slightly
+     different order from print_object, there is a risk of giving up
+     too soon.  In that case, a deeply nested circular list may cause
+     print_object to loop.  Using 3 * PRINT_CIRCLE should make this
+     possibility negligible, but at some point someone will have to
+     sit down and do a more careful analysis. -- cyd */
+  if (print_depth >= 3 * PRINT_CIRCLE)
     return;
 
   /* Avoid infinite recursion for circular nested structure
-- 
2.39.5