From 9e977c497257ff13bfb2579f8a14ca9b43791115 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 23 May 2020 10:38:53 -0700 Subject: [PATCH] Restore check for Emacs 20.2 bytecodes * src/eval.c (Ffetch_bytecode): Check for multibyte bytecodes here too. Problem reported by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2020-05/msg02876.html --- src/eval.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index be2af2d041b..959adea6467 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3202,7 +3202,19 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, else error ("Invalid byte code"); } - ASET (object, COMPILED_BYTECODE, XCAR (tem)); + + Lisp_Object bytecode = XCAR (tem); + if (STRING_MULTIBYTE (bytecode)) + { + /* BYTECODE must have been produced by Emacs 20.2 or earlier + because it produced a raw 8-bit string for byte-code and now + such a byte-code string is loaded as multibyte with raw 8-bit + characters converted to multibyte form. Convert them back to + the original unibyte form. */ + bytecode = Fstring_as_unibyte (bytecode); + } + + ASET (object, COMPILED_BYTECODE, bytecode); ASET (object, COMPILED_CONSTANTS, XCDR (tem)); } } -- 2.39.5