GNU bug report logs -
#78786
31.0.50; eieio-core.el requires byte compilation
Previous Next
Reported by: Pip Cet <pipcet <at> protonmail.com>
Date: Fri, 13 Jun 2025 15:21:01 UTC
Severity: normal
Found in version 31.0.50
Done: Pip Cet <pipcet <at> protonmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
"Stefan Monnier" <monnier <at> iro.umontreal.ca> writes:
>> I propose moving to cl--class-* accessors where we can, and calling
>> eieio--class-slot-name-index and eieio--class-initarg-to-attribute only
>> on known/checked eieio--class objects.
>
> Yes, calling `eieio--class-slot-name-index` on non-EIEIO classes is
> a bug, we should fix the code to do it only when it is an EIEIO class.
So this?
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index 72640e88301..6d9a0199ea6 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -740,7 +740,8 @@ eieio-oref
(if (not c)
;; It might be missing because it is a :class allocated slot.
;; Let's check that info out.
- (if (setq c (eieio--class-slot-name-index class slot))
+ (if (and (eieio--class-p class)
+ (setq c (eieio--class-slot-name-index class slot)))
;; Oref that slot.
(aref (eieio--class-class-allocation-values class) c)
;; The slot-missing method is a cool way of allowing an object author
@@ -783,8 +784,9 @@ eieio-oref-default
(if (not c)
;; It might be missing because it is a :class allocated slot.
;; Let's check that info out.
- (if (setq c
- (eieio--class-slot-name-index cl slot))
+ (if (and (eieio--class-p cl)
+ (setq c
+ (eieio--class-slot-name-index cl slot)))
;; Oref that slot.
(aref (eieio--class-class-allocation-values cl)
c)
@@ -808,8 +810,9 @@ eieio-oset
(if (not c)
;; It might be missing because it is a :class allocated slot.
;; Let's check that info out.
- (if (setq c
- (eieio--class-slot-name-index class slot))
+ (if (and (eieie--class-p class)
+ (setq c
+ (eieio--class-slot-name-index class slot)))
;; Oset that slot.
(progn
(eieio--validate-class-slot-value class c value slot)
@@ -849,7 +852,8 @@ eieio-oset-default
(if (not c)
;; It might be missing because it is a :class allocated slot.
;; Let's check that info out.
- (if (setq c (eieio--class-slot-name-index class slot))
+ (if (and (eieio--class-p class)
+ (setq c (eieio--class-slot-name-index class slot)))
(progn
;; Oref that slot.
(eieio--validate-class-slot-value class c value slot)
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index fced6bc3df2..f00914d9fe9 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -1047,7 +1047,8 @@ eieio-test-defstruct-slot-value
(slot-value x 'c)))
(setf (slot-value x 'a) 1)
(should (eq (eieio-test--struct-a x) 1))
- (should-error (setf (slot-value x 'c) 3) :type 'eieio-read-only)))
+ (should-error (setf (slot-value x 'c) 3) :type 'eieio-read-only)
+ (should-error (eieio-oref x 'd) :type 'invalid-slot-name)))
(defclass foo-bug-66938 (eieio-instance-inheritor)
((x :initarg :x
The new test didn't actually fail before, but I figured it might catch
some future bug.
Pip
This bug report was last modified 8 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.