bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44155: Print integers as characters


From: Juri Linkov
Subject: bug#44155: Print integers as characters
Date: Sun, 01 Nov 2020 09:58:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> New test fails on some systems.
>
>       (equal
>        (-1 0 1 80 4194175 128 255 4194304)
>        (-1 0 1 80 4194175 4194176 4194303 4194304))
>       :value nil :explanation
>       (list-elt 5
>                 (different-atoms
>                  (128 "#x80" "?")
>                  (4194176 "#x3fff80" "?\200")))))

This is because 4194176 is printed as ?\200 that is parsed as 128.

This patch should fix test failures by printing integers
for ambiguous characters.  I'm sure no user would complain
that numbers between 4194176 and 4194303 are printed as integers.

diff --git a/src/print.c b/src/print.c
index fa65a3cb26..49daf753bd 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1912,7 +1912,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
        intmax_t i;
 
        if (EQ (Vinteger_output_format, Qt) && CHARACTERP (obj)
-           && (c = XFIXNUM (obj)))
+           && (c = XFIXNUM (obj)) && ! CHAR_BYTE8_P (c))
          {
            printchar ('?', printcharfun);
            if (escapeflag





reply via email to

[Prev in Thread] Current Thread [Next in Thread]