Subject: bug#6991: Please keep bytecode out of *Backtrace* buffers

From: Stefan Monnier <[email-masked]>
Date: Mon, 02 Jul 2012 14:38:40 -0400

>> > Why?  No reason given.  This is a reasonable request, which 
>> > would improve correspondence about bugs and user difficulties.
> And no response to that question.  I've reopened this bug.

You can try the simple patch below.  It doesn't cut it for me, and
I think the only way to make it work well would be to change the
representation of the byte-codes so that they're not just a "unibyte
string" but an object with a distinctive type: the patch only catches
the case where the byte-codes appear within a printed
byte-compiled-function, not when they're arguments to the `byte-code'
function or to the `make-byte-code' function, and I'm sure there can be
other cases.

        Stefan

=== modified file 'src/print.c'
--- src/print.c	2012-06-28 11:11:48 +0000
+++ src/print.c	2012-07-02 18:37:46 +0000
@@ -1937,8 +1937,11 @@
       else
 	{
 	  ptrdiff_t size = ASIZE (obj);
+	  int bytecode = 0;
+
 	  if (COMPILEDP (obj))
 	    {
 	      PRINTCHAR ('#');
+	      bytecode = 1;
 	      size &= PSEUDOVECTOR_SIZE_MASK;
 	    }
@@ -1978,6 +1981,9 @@
 	      {
 		if (i) PRINTCHAR (' ');
 		tem = AREF (obj, i);
+		if (bytecode && i == 1 && INTEGERP (Vprint_level))
+		  strout ("\"..<bytecode>..\"", 16, 16, printcharfun);
+		else
 		print_object (tem, printcharfun, escapeflag);
 	      }
 	    if (size < real_size)