emacs-diffs
[Top][All Lists]
Advanced

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

scratch/sqlite 096d82b: Check more thoroughly for unprintable objects


From: Lars Ingebrigtsen
Subject: scratch/sqlite 096d82b: Check more thoroughly for unprintable objects
Date: Wed, 15 Dec 2021 02:05:25 -0500 (EST)

branch: scratch/sqlite
commit 096d82be9ab71f04e0639e7259095f939832e061
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Check more thoroughly for unprintable objects
---
 lisp/emacs-lisp/multisession.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
index f47a915..711253b 100644
--- a/lisp/emacs-lisp/multisession.el
+++ b/lisp/emacs-lisp/multisession.el
@@ -218,8 +218,9 @@ DOC should be a doc string, and ARGS are keywords as 
applicable to
                  (print-circle t)
                  (print-level nil))
              (prin1-to-string value))))
-      (when (string-match-p "\\`#" pvalue)
-        (error "Unable to store unreadable value: %s" pvalue))
+      (condition-case nil
+          (read-from-string pvalue)
+        (error (error "Unable to store unreadable value: %s" pvalue)))
       (sqlite-execute
        multisession--db
        "insert into multisession(package, key, sequence, value) values(?, ?, 
1, ?) on conflict(package, key) do update set sequence = sequence + 1, value = 
?"
@@ -305,8 +306,9 @@ DOC should be a doc string, and ARGS are keywords as 
applicable to
             (print-level nil))
         (prin1 value (current-buffer)))
       (goto-char (point-min))
-      (when (looking-at-p "#")
-        (error "Unable to store unreadable value: %s" (buffer-string)))
+      (condition-case nil
+          (read (current-buffer))
+        (error (error "Unable to store unreadable value: %s" (buffer-string))))
       ;; Write to a temp file in the same directory and rename to the
       ;; file for somewhat better atomicity.
       (let ((coding-system-for-write 'utf-8)



reply via email to

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