• Noam Postavsky's avatar
    Use plain symbols for eieio type descriptors (Bug#29220) · 5f01af6c
    Noam Postavsky authored
    Since Emacs 26, eieio objects use a class record (with circular
    references) as the type descriptor of the object record.  This causes
    problems when reading back an object from a string, because the class
    record is not `eq' to the canonical one (which means that read objects
    don't satisfy the foo-p predicate).
    * lisp/emacs-lisp/eieio.el (make-instance): As a (partial) fix, set
    the record's type descriptor to a plain symbol for the type descriptor
    when eieio-backward-compatibility is non-nil (the default).
    * lisp/emacs-lisp/eieio-core.el (eieio--object-class): Call
    eieio--class-object on the type tag when eieio-backward-compatibility
    is non-nil.
    (eieio-object-p): Use eieio--object-class instead of
    eieio--object-class-tag.
    * test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
    (eieio-test-persist-hash-and-vector)
    (eieio-test-persist-interior-lists): Make into functions.
    (eieio-persist-hash-and-vector-backward-compatibility)
    (eieio-persist-hash-and-vector-no-backward-compatibility)
    (eieio-test-persist-interior-lists-backward-compatibility)
    (eieio-test-persist-interior-lists-no-backward-compatibility): New
    tests which call them, eieio-backward-compatibility let-bound.
    5f01af6c
eieio-core.el 42.9 KB