From unknown Sat Aug 16 18:43:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78786: 31.0.50; eieio-core.el requires byte compilation Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Jun 2025 15:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78786 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 78786@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174982805914823 (code B ref -1); Fri, 13 Jun 2025 15:21:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Jun 2025 15:20:59 +0000 Received: from localhost ([127.0.0.1]:48364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uQ6D9-0003qC-K0 for submit@debbugs.gnu.org; Fri, 13 Jun 2025 11:20:58 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55254) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uQ6D7-0003pZ-9W for submit@debbugs.gnu.org; Fri, 13 Jun 2025 11:20:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uQ6Cu-0005Xb-5r for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2025 11:20:40 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uQ6Cr-0003Vj-SK for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2025 11:20:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1749828035; x=1750087235; bh=iTgSQtQYVJPPQN/TVjNEbqfWfxd3QiWMhbU/jUkvxE0=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=ehP/S4FqJYhdNeR+R4Dauj+//0WHRHsPgn6P6YfduYiUexXxi0l56u09Hw3MFd+Ge XSsEKP5/J3XUKyihvXgWxjWQt/Y96z7NIdomrtXG52tULw4a7FdxRL5V19VQaqIiET 79LyTbW/B2HgLxffMfhcDy8bLlewIn8NNSBOoMkVla++ikPaqvfRCgiQrNVEQ6+Wl7 HL+iXJY45H1pGjQKEk/OzE3gjq0sQ+ofUxK0zKH8t97JXlrRD4HbntW+h4HltE28cM 4EIv72TcSQ1ZiZpCt/jaU4ThGxlt1dQkpJVp2yrRgyT6NnBoeWZSADpUcQ/RtvveA+ UwrDUvBMjHf2A== Date: Fri, 13 Jun 2025 15:20:32 +0000 From: Pip Cet Message-ID: <87zfebwtvn.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 5c50ec6db8ae671554d0b56e0ee940b5420a3d2a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.43.16; envelope-from=pipcet@protonmail.com; helo=mail-4316.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Evaluating eieio-core.el without compilation currently results in breakage: (load "eieio-core.el") (cl-defstruct foo x) (eieio-oset (make-foo) 'x nil) results in: signal(wrong-type-argument (eieio--class #s(cl-structure-class :name foo = :docstring nil :parents (#s(cl-structure-class :name cl-structure-object :d= ocstring "The root parent of all \"normal\" CL structs" :parents (#s(built-= in-class :name record :docstring "Abstract type of objects with slots." :pa= rents (...) :slots nil :index-table nil)) :slots [] :index-table # :tag cl-structure-object :type nil :named nil :print t :chil= dren-sym cl-struct-cl-structure-object-tags)) :slots [#s(cl-slot-descriptor= :name x :initform nil :type t :props nil)] :index-table # :tag foo :type nil :named nil :print t :children-sym cl-struct-foo-t= ags))) (or (let* ((cl-x cl-x)) (and (memq (type-of cl-x) cl-struct-eieio--class-= tags) t)) (signal 'wrong-type-argument (list 'eieio--class cl-x))) (progn (or (let* ((cl-x cl-x)) (and (memq (type-of cl-x) cl-struct-eieio-= -class-tags) t)) (signal 'wrong-type-argument (list 'eieio--class cl-x))) (= aref cl-x 4)) (let* ((cl-x class)) (progn (or (let* ((cl-x cl-x)) (and (memq (type-of c= l-x) cl-struct-eieio--class-tags) t)) (signal 'wrong-type-argument (list 'e= ieio--class cl-x))) (aref cl-x 4))) (aref (let* ((cl-x class)) (progn (or (let* ((cl-x cl-x)) (and (memq (typ= e-of cl-x) cl-struct-eieio--class-tags) t)) (signal 'wrong-type-argument (l= ist 'eieio--class cl-x))) (aref cl-x 4))) slot-idx) (let* ((sd (aref (let* ((cl-x class)) (progn (or (let* ... ...) (signal .= .. ...)) (aref cl-x 4))) slot-idx)) (st (let* ((cl-x sd)) (progn (or (let* = (...) (and ... t)) (signal 'wrong-type-argument (list ... cl-x))) (aref cl-= x 3))))) (cond ((not (eieio--perform-slot-validation st value)) (signal 'in= valid-slot-type (list (let* ((cl-x class)) (progn (or ... ...) (aref cl-x 1= ))) slot st value))) ((alist-get :read-only (let* ((cl-x sd)) (progn (or (l= et* ... ...) (signal ... ...)) (aref cl-x 4)))) (signal 'eieio-read-only (l= ist (let* ((cl-x class)) (progn (or ... ...) (aref cl-x 1))) slot))))) (if eieio-skip-typecheck nil (setq slot-idx (- slot-idx '1)) (let* ((sd (= aref (let* ((cl-x class)) (progn (or ... ...) (aref cl-x 4))) slot-idx)) (s= t (let* ((cl-x sd)) (progn (or (let* ... ...) (signal ... ...)) (aref cl-x = 3))))) (cond ((not (eieio--perform-slot-validation st value)) (signal 'inva= lid-slot-type (list (let* (...) (progn ... ...)) slot st value))) ((alist-g= et :read-only (let* ((cl-x sd)) (progn (or ... ...) (aref cl-x 4)))) (signa= l 'eieio-read-only (list (let* (...) (progn ... ...)) slot)))))) eieio--validate-slot-value(#s(cl-structure-class :name foo :docstring nil= :parents (#s(cl-structure-class :name cl-structure-object :docstring "The = root parent of all \"normal\" CL structs" :parents (#s(built-in-class :name= record :docstring "Abstract type of objects with slots." :parents (#s(buil= t-in-class :name atom :docstring "Abstract supertype of anything but cons c= ells." :parents ... :slots nil :index-table nil)) :slots nil :index-table n= il)) :slots [] :index-table # :tag cl-structure-obje= ct :type nil :named nil :print t :children-sym cl-struct-cl-structure-objec= t-tags)) :slots [#s(cl-slot-descriptor :name x :initform nil :type t :props= nil)] :index-table # :tag foo :type nil :named nil = :print t :children-sym cl-struct-foo-tags) 1 nil x) The expected behavior is for this code to complete without error. The failure is because eieio--validate-slot-value is called for a class (object) of type cl-structure-object, but calls eieio--class-slots on that object; it could call cl--class-slots instead, and then this bug wouldn't happen. When byte-compiled, we optimize out the type checks so everything works. This is achieved by the cl-declaim calls surrounding the cl-defstruct of eieio--class. When interpreted directly, cl-defstruct always adds the type checks, so the error pops up. However, I have my doubts about whether we might end up calling eieio--class-class-slots or eieio--class-initarg-tuples on a cl-structure-object, which would return its "type" or "named" slots (unless I miscounted, sorry). So I'd like to fix these while we're there (in the latter case, we're on slow code paths so this should not be a problem; in the former case, if there is a performance impact, we could consider moving the class-slots slot to cl--class instead, reserving a useless slot in it for cl-structure-object objects). 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. But if an alternative is desired (I think this may be the case because I suggested changing one of the accessors before), and the initarg/class-slot case is always safe, we could simply error out when trying to evaluate eieio-core.el directly rather than compiling it. While this is related to bug#78685, I think there are other, non-bug-induced circumstances in which we end up interpreting eieio-core.el, so we should either allow it or make it fail less subtly. From unknown Sat Aug 16 18:43:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78786: 31.0.50; eieio-core.el requires byte compilation Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Jul 2025 16:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78786 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: 78786@debbugs.gnu.org Received: via spool by 78786-submit@debbugs.gnu.org id=B78786.175173263830234 (code B ref 78786); Sat, 05 Jul 2025 16:24:02 +0000 Received: (at 78786) by debbugs.gnu.org; 5 Jul 2025 16:23:58 +0000 Received: from localhost ([127.0.0.1]:46455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uY5gD-0007rZ-Nx for submit@debbugs.gnu.org; Sat, 05 Jul 2025 12:23:58 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5838) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uY5gA-0007qf-Dk for 78786@debbugs.gnu.org; Sat, 05 Jul 2025 12:23:55 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F2B394415B0; Sat, 5 Jul 2025 12:23:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751732626; bh=5EwNHWlD1aHMyj7iq2bXxcxIr9G/yY7VXZ/3lohStGE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=l060kFVKlqs22mFQET/AWJcrktii2LGIM+JLGmhtu4T3GebT4J6oaTx+1ErP1nHRD Vg3q7aqDSV32ExrDYxNPJmSzFrwhgodJKKBfBpMmZZquPzpd0KAUhWZNyDdVU85t1a iNJLnzl4752Dhm/sysL6xav1LdA5+83lEUyxZ6E1+EYM6sifZrpM/Q+T0kkugg5Rpu nrFb/MvponC8u9VQh4Nnhk/BJ3YvZSJB9fxkRHw1SyIzLA0gUdhi60UwgPz4QU+d34 Jyem7P+7PVifEoBUVwYidZafSv7GnUZbWeXE0mFqwcnKgO46UDbCfU9PmEKjIVS7i8 Metvd1kiVRCTQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DBA10441550; Sat, 5 Jul 2025 12:23:46 -0400 (EDT) Received: from alfajor (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AD2521204B0; Sat, 5 Jul 2025 12:23:46 -0400 (EDT) From: Stefan Monnier In-Reply-To: <87zfebwtvn.fsf@protonmail.com> Message-ID: References: <87zfebwtvn.fsf@protonmail.com> Date: Sat, 05 Jul 2025 12:23:45 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.279 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) > 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. Stefan From unknown Sat Aug 16 18:43:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78786: 31.0.50; eieio-core.el requires byte compilation Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Jul 2025 19:01:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78786 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 78786@debbugs.gnu.org Received: via spool by 78786-submit@debbugs.gnu.org id=B78786.175174201623825 (code B ref 78786); Sat, 05 Jul 2025 19:01:04 +0000 Received: (at 78786) by debbugs.gnu.org; 5 Jul 2025 19:00:16 +0000 Received: from localhost ([127.0.0.1]:47293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uY87R-0006BD-Pn for submit@debbugs.gnu.org; Sat, 05 Jul 2025 15:00:15 -0400 Received: from mail-10629.protonmail.ch ([79.135.106.29]:38325) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uY87L-00066g-Ne for 78786@debbugs.gnu.org; Sat, 05 Jul 2025 15:00:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1751741999; x=1752001199; bh=f7oxz3VUEzXU+k28SDvIV0hm641LgbBw3vqf6CgM/7Y=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=rTDH4hrvxg2fRMl2i2lnnl3jO6zng2gWyuCwPurxf8BHD25Pt3Ix1qqqUcxfST8B3 5NRRBFhEhtGH8D1TPPKS5DLZgSB9AWsqyJQOEjDvAPike2pAvBwZnjUjR2OoUh67dv UV3bVrRAMCg7V+rcRTvbgBzAHNHMmx9gvGBcIDsl4yjlEJcqEsDJyDfvWW0g3Xyjid QYe7F6tQIWN+S5cwgFtFLfp9bG3GhWYX4rNQkNpdbRoA8DTeIMneTiDh1Q346FNDE+ HIT5u35lgGXGAG7/OxNRh3K5AquXticXtyvov74gXDEP/GBH8vNiTpqvukTSQpGETC oCB751hvLS5Rw== Date: Sat, 05 Jul 2025 18:59:56 +0000 From: Pip Cet Message-ID: <87pleetqdy.fsf@protonmail.com> In-Reply-To: References: <87zfebwtvn.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: fb236c5003fa111537ea248ae2801180e9e3be7f MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) "Stefan Monnier" 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) =09 ;; It might be missing because it is a :class allocated slot. =09 ;; Let's check that info out. -=09 (if (setq c (eieio--class-slot-name-index class slot)) +=09 (if (and (eieio--class-p class) + (setq c (eieio--class-slot-name-index class slot))) =09 ;; Oref that slot. =09 (aref (eieio--class-class-allocation-values class) c) =09 ;; The slot-missing method is a cool way of allowing an object auth= or @@ -783,8 +784,9 @@ eieio-oref-default (if (not c) =09;; It might be missing because it is a :class allocated slot. =09;; Let's check that info out. -=09(if (setq c -=09=09 (eieio--class-slot-name-index cl slot)) +=09(if (and (eieio--class-p cl) + (setq c +=09=09 (eieio--class-slot-name-index cl slot))) =09 ;; Oref that slot. =09 (aref (eieio--class-class-allocation-values cl) =09=09 c) @@ -808,8 +810,9 @@ eieio-oset (if (not c) =09 ;; It might be missing because it is a :class allocated slot. =09 ;; Let's check that info out. -=09 (if (setq c -=09=09 (eieio--class-slot-name-index class slot)) +=09 (if (and (eieie--class-p class) + (setq c +=09=09 (eieio--class-slot-name-index class slot))) =09 ;; Oset that slot. =09 (progn =09 (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/em= acs-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))) =20 (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 From unknown Sat Aug 16 18:43:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78786: 31.0.50; eieio-core.el requires byte compilation Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Jul 2025 21:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78786 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: 78786@debbugs.gnu.org Received: via spool by 78786-submit@debbugs.gnu.org id=B78786.175175105020447 (code B ref 78786); Sat, 05 Jul 2025 21:31:01 +0000 Received: (at 78786) by debbugs.gnu.org; 5 Jul 2025 21:30:50 +0000 Received: from localhost ([127.0.0.1]:47908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uYAT9-0005JP-W9 for submit@debbugs.gnu.org; Sat, 05 Jul 2025 17:30:49 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60312) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uYAT7-0005I7-5H for 78786@debbugs.gnu.org; Sat, 05 Jul 2025 17:30:46 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5DCA880A13; Sat, 5 Jul 2025 17:30:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751751038; bh=cacnUIlYDdg/CeUAW3GNFvLQHENrrBYXyxrN33jbgDU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=KcWq4Mzzgb22Tb6enZwH5PlKCe1Gun8cfr+AXb+o5Lhdjktx7K0Vupybzb4FrdLMV CWoWC8EigVksOdcH1wJkpf5ef3dEIgHfYn6TYSOrhSFsu2f5WI9ZVmby0XRswurxRK rsU1Rpe69hBj9bV7L4tT8wB4nhP8Z4nnozNhmYLToW9A4RVnKcRc7MasH+C0hDL8xf vbh0AeZcbSEp8viaBEnTvQLkUM1kik0OBLtQ6fw4u3f3W0ulTpRnmtaRkrBdKXc9DR Jl0P6S1esnoHxBocz6I5kKaKCJTA+uXC7s1LDeyJYVSsG9Y7zlyfX4NqVq9nM6v4lH bNqQ4SIAegTVQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 592DA8098D; Sat, 5 Jul 2025 17:30:38 -0400 (EDT) Received: from alfajor (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2D4F0120225; Sat, 5 Jul 2025 17:30:38 -0400 (EDT) From: Stefan Monnier In-Reply-To: <87pleetqdy.fsf@protonmail.com> Message-ID: References: <87zfebwtvn.fsf@protonmail.com> <87pleetqdy.fsf@protonmail.com> Date: Sat, 05 Jul 2025 17:30:37 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.304 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >> 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? LGTM, yes. Stefan > 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 From unknown Sat Aug 16 18:43:44 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Pip Cet Subject: bug#78786: closed (Re: bug#78786: 31.0.50; eieio-core.el requires byte compilation) Message-ID: References: <87v7o1qt24.fsf@protonmail.com> <87zfebwtvn.fsf@protonmail.com> X-Gnu-PR-Message: they-closed 78786 X-Gnu-PR-Package: emacs Reply-To: 78786@debbugs.gnu.org Date: Wed, 09 Jul 2025 15:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1752075182-9906-1" This is a multi-part message in MIME format... ------------=_1752075182-9906-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #78786: 31.0.50; eieio-core.el requires byte compilation which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 78786@debbugs.gnu.org. --=20 78786: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78786 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1752075182-9906-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 78786-done) by debbugs.gnu.org; 9 Jul 2025 15:32:09 +0000 Received: from localhost ([127.0.0.1]:51591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uZWmG-0002R8-A7 for submit@debbugs.gnu.org; Wed, 09 Jul 2025 11:32:09 -0400 Received: from mail-24416.protonmail.ch ([109.224.244.16]:24293) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uZWmB-0002Os-J5 for 78786-done@debbugs.gnu.org; Wed, 09 Jul 2025 11:32:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1752075116; x=1752334316; bh=8B5RynBDfTBvQ5XEJsvKwvHeoBZ0bn30TOsCyRrOP3w=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=uaBMydEhKWp+fMF9T28XoY5oVnY+R4wwaMq49aeSh7HFm7NU9mZaH6dChLB+AjN5U 2pZLJ4QO+l5GhfZeQAsu9iz/gzjM2tyfc0ZIfnSNQNkcI8CgSoLaGkupCKPZCIUMlQ uJJcKnsWzjy0RAeoYRBdMjOXlclQYmU7/V/sXCbbJToKjeWs+4LTh1KggwI6gFGuCS GmJTSVi8PWpPuX9mK8T1OtCA9N9DddDvKQDBXk7MZztENdH3P47jiJcn67TSzqRrLg 3nxaHjy3yIOuExjOZ8+DhMlkB2ew5nTvBH+zoKl+tL3Ku4vFQpjgKkAbfXd6xLWcq6 NulUjb6x2iSug== Date: Wed, 09 Jul 2025 15:31:53 +0000 To: Stefan Monnier From: Pip Cet Subject: Re: bug#78786: 31.0.50; eieio-core.el requires byte compilation Message-ID: <87v7o1qt24.fsf@protonmail.com> In-Reply-To: References: <87zfebwtvn.fsf@protonmail.com> <87pleetqdy.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 55c00cee935f777a25fc8631571a93fe16c3b7ec MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78786-done Cc: 78786-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Stefan Monnier" writes: >>> 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? > > LGTM, yes. Pushed, thanks. Closing this bug optimistically. >> @@ -808,8 +810,9 @@ eieio-oset >> (if (not c) >> =09 ;; It might be missing because it is a :class allocated slot. >> =09 ;; Let's check that info out. >> -=09 (if (setq c >> -=09=09 (eieio--class-slot-name-index class slot)) >> +=09 (if (and (eieie--class-p class) ^ Fixed this one. Pip ------------=_1752075182-9906-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Jun 2025 15:20:59 +0000 Received: from localhost ([127.0.0.1]:48364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uQ6D9-0003qC-K0 for submit@debbugs.gnu.org; Fri, 13 Jun 2025 11:20:58 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55254) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uQ6D7-0003pZ-9W for submit@debbugs.gnu.org; Fri, 13 Jun 2025 11:20:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uQ6Cu-0005Xb-5r for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2025 11:20:40 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uQ6Cr-0003Vj-SK for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2025 11:20:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1749828035; x=1750087235; bh=iTgSQtQYVJPPQN/TVjNEbqfWfxd3QiWMhbU/jUkvxE0=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=ehP/S4FqJYhdNeR+R4Dauj+//0WHRHsPgn6P6YfduYiUexXxi0l56u09Hw3MFd+Ge XSsEKP5/J3XUKyihvXgWxjWQt/Y96z7NIdomrtXG52tULw4a7FdxRL5V19VQaqIiET 79LyTbW/B2HgLxffMfhcDy8bLlewIn8NNSBOoMkVla++ikPaqvfRCgiQrNVEQ6+Wl7 HL+iXJY45H1pGjQKEk/OzE3gjq0sQ+ofUxK0zKH8t97JXlrRD4HbntW+h4HltE28cM 4EIv72TcSQ1ZiZpCt/jaU4ThGxlt1dQkpJVp2yrRgyT6NnBoeWZSADpUcQ/RtvveA+ UwrDUvBMjHf2A== Date: Fri, 13 Jun 2025 15:20:32 +0000 To: bug-gnu-emacs@gnu.org From: Pip Cet Subject: 31.0.50; eieio-core.el requires byte compilation Message-ID: <87zfebwtvn.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 5c50ec6db8ae671554d0b56e0ee940b5420a3d2a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.43.16; envelope-from=pipcet@protonmail.com; helo=mail-4316.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Evaluating eieio-core.el without compilation currently results in breakage: (load "eieio-core.el") (cl-defstruct foo x) (eieio-oset (make-foo) 'x nil) results in: signal(wrong-type-argument (eieio--class #s(cl-structure-class :name foo = :docstring nil :parents (#s(cl-structure-class :name cl-structure-object :d= ocstring "The root parent of all \"normal\" CL structs" :parents (#s(built-= in-class :name record :docstring "Abstract type of objects with slots." :pa= rents (...) :slots nil :index-table nil)) :slots [] :index-table # :tag cl-structure-object :type nil :named nil :print t :chil= dren-sym cl-struct-cl-structure-object-tags)) :slots [#s(cl-slot-descriptor= :name x :initform nil :type t :props nil)] :index-table # :tag foo :type nil :named nil :print t :children-sym cl-struct-foo-t= ags))) (or (let* ((cl-x cl-x)) (and (memq (type-of cl-x) cl-struct-eieio--class-= tags) t)) (signal 'wrong-type-argument (list 'eieio--class cl-x))) (progn (or (let* ((cl-x cl-x)) (and (memq (type-of cl-x) cl-struct-eieio-= -class-tags) t)) (signal 'wrong-type-argument (list 'eieio--class cl-x))) (= aref cl-x 4)) (let* ((cl-x class)) (progn (or (let* ((cl-x cl-x)) (and (memq (type-of c= l-x) cl-struct-eieio--class-tags) t)) (signal 'wrong-type-argument (list 'e= ieio--class cl-x))) (aref cl-x 4))) (aref (let* ((cl-x class)) (progn (or (let* ((cl-x cl-x)) (and (memq (typ= e-of cl-x) cl-struct-eieio--class-tags) t)) (signal 'wrong-type-argument (l= ist 'eieio--class cl-x))) (aref cl-x 4))) slot-idx) (let* ((sd (aref (let* ((cl-x class)) (progn (or (let* ... ...) (signal .= .. ...)) (aref cl-x 4))) slot-idx)) (st (let* ((cl-x sd)) (progn (or (let* = (...) (and ... t)) (signal 'wrong-type-argument (list ... cl-x))) (aref cl-= x 3))))) (cond ((not (eieio--perform-slot-validation st value)) (signal 'in= valid-slot-type (list (let* ((cl-x class)) (progn (or ... ...) (aref cl-x 1= ))) slot st value))) ((alist-get :read-only (let* ((cl-x sd)) (progn (or (l= et* ... ...) (signal ... ...)) (aref cl-x 4)))) (signal 'eieio-read-only (l= ist (let* ((cl-x class)) (progn (or ... ...) (aref cl-x 1))) slot))))) (if eieio-skip-typecheck nil (setq slot-idx (- slot-idx '1)) (let* ((sd (= aref (let* ((cl-x class)) (progn (or ... ...) (aref cl-x 4))) slot-idx)) (s= t (let* ((cl-x sd)) (progn (or (let* ... ...) (signal ... ...)) (aref cl-x = 3))))) (cond ((not (eieio--perform-slot-validation st value)) (signal 'inva= lid-slot-type (list (let* (...) (progn ... ...)) slot st value))) ((alist-g= et :read-only (let* ((cl-x sd)) (progn (or ... ...) (aref cl-x 4)))) (signa= l 'eieio-read-only (list (let* (...) (progn ... ...)) slot)))))) eieio--validate-slot-value(#s(cl-structure-class :name foo :docstring nil= :parents (#s(cl-structure-class :name cl-structure-object :docstring "The = root parent of all \"normal\" CL structs" :parents (#s(built-in-class :name= record :docstring "Abstract type of objects with slots." :parents (#s(buil= t-in-class :name atom :docstring "Abstract supertype of anything but cons c= ells." :parents ... :slots nil :index-table nil)) :slots nil :index-table n= il)) :slots [] :index-table # :tag cl-structure-obje= ct :type nil :named nil :print t :children-sym cl-struct-cl-structure-objec= t-tags)) :slots [#s(cl-slot-descriptor :name x :initform nil :type t :props= nil)] :index-table # :tag foo :type nil :named nil = :print t :children-sym cl-struct-foo-tags) 1 nil x) The expected behavior is for this code to complete without error. The failure is because eieio--validate-slot-value is called for a class (object) of type cl-structure-object, but calls eieio--class-slots on that object; it could call cl--class-slots instead, and then this bug wouldn't happen. When byte-compiled, we optimize out the type checks so everything works. This is achieved by the cl-declaim calls surrounding the cl-defstruct of eieio--class. When interpreted directly, cl-defstruct always adds the type checks, so the error pops up. However, I have my doubts about whether we might end up calling eieio--class-class-slots or eieio--class-initarg-tuples on a cl-structure-object, which would return its "type" or "named" slots (unless I miscounted, sorry). So I'd like to fix these while we're there (in the latter case, we're on slow code paths so this should not be a problem; in the former case, if there is a performance impact, we could consider moving the class-slots slot to cl--class instead, reserving a useless slot in it for cl-structure-object objects). 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. But if an alternative is desired (I think this may be the case because I suggested changing one of the accessors before), and the initarg/class-slot case is always safe, we could simply error out when trying to evaluate eieio-core.el directly rather than compiling it. While this is related to bug#78685, I think there are other, non-bug-induced circumstances in which we end up interpreting eieio-core.el, so we should either allow it or make it fail less subtly. ------------=_1752075182-9906-1--