1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Further fix to eieio-persistent

* lisp/emacs-lisp/eieio-base.el (eieio-persistent-validate/fix-slot-value):
  Make handling of hash tables and vectors recursive. This is
  necessary because the write process, in `eieio-override-prin1' is
  also recursive. With any luck, this will be the last fix of its
  kind. If that's true, cherry-pick to Emacs 26.2 later on.
This commit is contained in:
Eric Abrahamsen 2018-04-08 16:49:20 -07:00
parent 86d2169ac3
commit 2cae1cf6f8

View file

@ -360,32 +360,30 @@ Second, any text properties will be stripped from strings."
proposed-value)))) proposed-value))))
;; For hash-tables and vectors, the top-level `read' will not ;; For hash-tables and vectors, the top-level `read' will not
;; "look inside" member values, so we need to do that ;; "look inside" member values, so we need to do that
;; explicitly. ;; explicitly. Because `eieio-override-prin1' is recursive in
;; the case of hash-tables and vectors, we recurse
;; `eieio-persistent-validate/fix-slot-value' here as well.
((hash-table-p proposed-value) ((hash-table-p proposed-value)
(maphash (maphash
(lambda (key value) (lambda (key value)
(cond ((class-p (car-safe value)) (setf (gethash key proposed-value)
(setf (gethash key proposed-value) (if (class-p (car-safe value))
(eieio-persistent-convert-list-to-object (eieio-persistent-convert-list-to-object
value))) value)
((and (consp value) (eieio-persistent-validate/fix-slot-value
(eq (car value) 'quote)) class slot value))))
(setf (gethash key proposed-value)
(cadr value)))))
proposed-value) proposed-value)
proposed-value) proposed-value)
((vectorp proposed-value) ((vectorp proposed-value)
(dotimes (i (length proposed-value)) (dotimes (i (length proposed-value))
(let ((val (aref proposed-value i))) (let ((val (aref proposed-value i)))
(cond ((class-p (car-safe val)) (aset proposed-value i
(aset proposed-value i (if (class-p (car-safe val))
(eieio-persistent-convert-list-to-object (eieio-persistent-convert-list-to-object
(aref proposed-value i)))) val)
((and (consp val) (eieio-persistent-validate/fix-slot-value
(eq (car val) 'quote)) class slot val)))))
(aset proposed-value i
(cadr val))))))
proposed-value) proposed-value)
((stringp proposed-value) ((stringp proposed-value)