From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Thomas Fitzsimmons Newsgroups: gmane.emacs.bugs Subject: bug#31742: 26.1.50; excorporate.elc byte-compiled in Emacs 25.x fails in Emacs 26.1 Date: Fri, 08 Jun 2018 22:54:17 -0400 Message-ID: References: <87po132y9k.fsf@gmail.com> <87h8me3hyw.fsf@gmail.com> <87zi0611m6.fsf@gmail.com> <87vaat1ndq.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1528512792 22120 195.159.176.226 (9 Jun 2018 02:53:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 9 Jun 2018 02:53:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) Cc: Noam Postavsky , 31742@debbugs.gnu.org To: Alex Harsanyi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 09 04:53:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRU02-0005dd-MQ for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jun 2018 04:53:07 +0200 Original-Received: from localhost ([::1]:38804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRU29-00030C-Ne for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Jun 2018 22:55:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRU1z-0002yY-6E for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 22:55:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRU1u-00080V-8L for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 22:55:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60514) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRU1t-00080O-Ur for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 22:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fRU1t-0002hF-Ij for bug-gnu-emacs@gnu.org; Fri, 08 Jun 2018 22:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thomas Fitzsimmons Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jun 2018 02:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31742 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31742-submit@debbugs.gnu.org id=B31742.152851286710317 (code B ref 31742); Sat, 09 Jun 2018 02:55:01 +0000 Original-Received: (at 31742) by debbugs.gnu.org; 9 Jun 2018 02:54:27 +0000 Original-Received: from localhost ([127.0.0.1]:40178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRU1L-0002gK-4R for submit@debbugs.gnu.org; Fri, 08 Jun 2018 22:54:27 -0400 Original-Received: from mail-it0-f66.google.com ([209.85.214.66]:40356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRU1J-0002g5-EM for 31742@debbugs.gnu.org; Fri, 08 Jun 2018 22:54:26 -0400 Original-Received: by mail-it0-f66.google.com with SMTP id 188-v6so3790094ita.5 for <31742@debbugs.gnu.org>; Fri, 08 Jun 2018 19:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fitzsim-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XOg9YuETgpQLjb7sqqkQR/BRAKLo233iVPX5DrO9cTI=; b=GTAV3uFj5ARVbccase6N86ruTHz0bHgayISKrF/1fR+VU1AKgYN1acy6smRCOpCYEb oyrLRHY8LaqAKqYNlybYUiWPSVsWQPreJIpzgGmZu+skKUwdp7RS4cyvEhmgnzxqCikm a74WKe2IrgtUvDlxAO6p5zGz1xL6tSlATHVGk8BdiJE/UyejfzmTwBGA0WCxL8D299LU l1UkE1XN5nPCGQea0x2qf2yxzw3Omfcz0koxImG5DXpWS0pjFiVtZ1oNX+blv3buFom7 lrQbbsiqoZ6TJhP2fuDk+itPsWAygIupH/wT8BF5Lp1Oc7YNtHeC9w4sXqH4xqay5Gui ctGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=XOg9YuETgpQLjb7sqqkQR/BRAKLo233iVPX5DrO9cTI=; b=sCAo+xMiyfVq52vomSqvOqhvFFd6VGubqAQv6zbUf6frv438jDFsUeYG/nMfzjCUxU 4f9mw3pMhhZtIhSGnCpJVu0dhiuK5lH6WMMfGGYGB07NDmF21ocFCwbFsdAX9Iz8W3oL tSeFMMhoSlF0vfNM+/o532rgJg11f73dYOGplqwMOMRlC+p08XgxZ8ZlNFPky/+mo2c9 KsbgqPKGUrmOH4HON8OZLkHNPUFZahos0E7gedxzsAS9/UBhlZ2OUNdXdofXPXMYFte9 XOrzPyK4UwV7pVbQbdqlHmlfbl70Ow/s+4CBRwp5i3s0//tgYJrA/v4APtIC8CwCffah WBoQ== X-Gm-Message-State: APt69E3yUzNlYmpxcf5B4MogV+LVclg2rfMEIDixzBRfoUhuwVjS4jfT RIW5ie/zYYMM8YD7iOIRp3INLpE4rGM= X-Google-Smtp-Source: ADUXVKIZfC2uO0clBOqUMH/twO9HDjppSSqjxzLB/7ghB828VVKB0U07MTj0M9dELK+TvQQ2UgVkqg== X-Received: by 2002:a24:4c6:: with SMTP id 189-v6mr4067138itb.53.1528512859635; Fri, 08 Jun 2018 19:54:19 -0700 (PDT) Original-Received: from hp-dv5t (69-165-165-189.dsl.teksavvy.com. [69.165.165.189]) by smtp.gmail.com with ESMTPSA id l22-v6sm3342972ioc.25.2018.06.08.19.54.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jun 2018 19:54:18 -0700 (PDT) In-Reply-To: (Alex Harsanyi's message of "Sat, 9 Jun 2018 08:01:31 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:147217 Archived-At: --=-=-= Content-Type: text/plain Alex Harsanyi writes: > On Fri, Jun 8, 2018 at 10:18 PM, Thomas Fitzsimmons wrote: >> (CCing Alex Harsanyi.) >> >> Noam Postavsky writes: >> >>> Thomas Fitzsimmons writes: >>> >>>> Noam Postavsky writes: >>>> >>>>> Thomas Fitzsimmons writes: >>>>> >>>>>> (defun soap-resolve-references (element wsdl) >>>>> >>>>>> (let ((resolver (get (aref element 0) 'soap-resolve-references))) >>>>> >>>>> Ah, then it should work to replace the (aref element 0) with (type-of >>>>> element) as long as cl-old-struct-compat-mode is enabled. >>>> >>>> Yes, I retested with that change and it does work. I guess I should >>>> submit a patch to change all those occurrences in soap-client. >>> >>> I just noticed soap-client is also an ELPA package; then there is the >>> additional complication that type-of will give the wrong answer in Emacs >>> versions 25 and older. So you would need something like >>> >>> (let ((type (type-of element))) >>> (if (eq type 'vector) >>> (aref element 0) ; For Emacs 25 and earlier. >>> type)) >> >> OK, I had that on my list to investigate before patching soap-client, >> the compatibility range of type-of, but you've done it for me, thanks. >> A soap-type-of compatibility function probably makes sense to replace >> the (aref ... 0) occurrences in soap-client and soap-inspect. >> >>>> I'm hoping cl-old-struct-compat-mode will continue to be enabled by >>>> default for a long time. >>> > > The `(aref element 0)` trick is the only one that `soap-client` uses. All > other struct usage is via accessor functions, the rest of the code does not > assume they are vectors. It seems to me that `cl-old-struct-compat-mode` is > not needed. OK. > Thomas, will you prepare the patch for soap-client? How about the attached? I tested it in 26.1 with 25.1 excorporate.elc byte-code, as well as with our test suite against 24.1, 25.1 and 26.1, so it should be OK for GNU ELPA as well. If this looks OK, I'll bump the soap-client.el version to 3.1.4 when I push. Thomas --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-soap-client-Add-byte-code-compatibility-function.patch >From 1638f42e494334696c3d3dc87c25af664086acaf Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Fri, 8 Jun 2018 22:41:28 -0400 Subject: [PATCH] soap-client: Add byte-code compatibility function * lisp/net/soap-client.el (soap-type-of): New function. (soap-resolve-references, soap-decode-type) (soap-encode-attributes, soap-encode-value): Replace aref calls with calls to soap-type-of. * lisp/net/soap-inspect.el (soap-sample-value, soap-inspect): Replace aref calls with calls to soap-type-of. Co-authored-by: Noam Postavsky --- lisp/net/soap-client.el | 44 ++++++++++++++++++++++++++------------------ lisp/net/soap-inspect.el | 44 ++++++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 40 deletions(-) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 3996da0..2535c34 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -685,8 +685,15 @@ soap-decode-xs-basic-type (anyType (soap-decode-any-type node)) (Array (soap-decode-array node)))))) +(defun soap-type-of (element) + "Return the type of ELEMENT." + (let ((type (type-of element))) + (if (eq type 'vector) + (aref element 0) ; For Emacs 25 and earlier. + type))) + ;; Register methods for `soap-xs-basic-type' -(let ((tag (aref (make-soap-xs-basic-type) 0))) +(let ((tag (soap-type-of (make-soap-xs-basic-type)))) (put tag 'soap-attribute-encoder #'soap-encode-xs-basic-type-attributes) (put tag 'soap-encoder #'soap-encode-xs-basic-type) (put tag 'soap-decoder #'soap-decode-xs-basic-type)) @@ -915,7 +922,7 @@ soap-decode-xs-element (soap-decode-type type node))) ;; Register methods for `soap-xs-element' -(let ((tag (aref (make-soap-xs-element) 0))) +(let ((tag (soap-type-of (make-soap-xs-element)))) (put tag 'soap-resolve-references #'soap-resolve-references-for-xs-element) (put tag 'soap-attribute-encoder #'soap-encode-xs-element-attributes) (put tag 'soap-encoder #'soap-encode-xs-element) @@ -1011,7 +1018,7 @@ soap-resolve-references-for-xs-attribute (setf (soap-xs-attribute-reference attribute) (soap-wsdl-get reference wsdl predicate))))) -(put (aref (make-soap-xs-attribute) 0) +(put (soap-type-of (make-soap-xs-attribute)) 'soap-resolve-references #'soap-resolve-references-for-xs-attribute) (defun soap-resolve-references-for-xs-attribute-group (attribute-group wsdl) @@ -1036,7 +1043,7 @@ soap-resolve-references-for-xs-attribute-group (setf (soap-xs-attribute-group-attribute-groups attribute-group) (soap-xs-attribute-group-attribute-groups resolved)))))) -(put (aref (make-soap-xs-attribute-group) 0) +(put (soap-type-of (make-soap-xs-attribute-group)) 'soap-resolve-references #'soap-resolve-references-for-xs-attribute-group) ;;;;; soap-xs-simple-type @@ -1374,7 +1381,7 @@ soap-decode-xs-simple-type (soap-validate-xs-simple-type value type)))) ;; Register methods for `soap-xs-simple-type' -(let ((tag (aref (make-soap-xs-simple-type) 0))) +(let ((tag (soap-type-of (make-soap-xs-simple-type)))) (put tag 'soap-resolve-references #'soap-resolve-references-for-xs-simple-type) (put tag 'soap-attribute-encoder #'soap-encode-xs-simple-type-attributes) @@ -1927,7 +1934,7 @@ soap-decode-xs-complex-type (soap-xs-complex-type-indicator type))))) ;; Register methods for `soap-xs-complex-type' -(let ((tag (aref (make-soap-xs-complex-type) 0))) +(let ((tag (soap-type-of (make-soap-xs-complex-type)))) (put tag 'soap-resolve-references #'soap-resolve-references-for-xs-complex-type) (put tag 'soap-attribute-encoder #'soap-encode-xs-complex-type-attributes) @@ -2147,7 +2154,7 @@ soap-resolve-references function depending on the type of the ELEMENT. If ELEMENT has no resolver function, it is silently ignored." - (let ((resolver (get (aref element 0) 'soap-resolve-references))) + (let ((resolver (get (soap-type-of element) 'soap-resolve-references))) (when resolver (funcall resolver element wsdl)))) @@ -2272,13 +2279,13 @@ soap-resolve-references-for-port ;; Install resolvers for our types (progn - (put (aref (make-soap-message) 0) 'soap-resolve-references + (put (soap-type-of (make-soap-message)) 'soap-resolve-references 'soap-resolve-references-for-message) - (put (aref (make-soap-operation) 0) 'soap-resolve-references + (put (soap-type-of (make-soap-operation)) 'soap-resolve-references 'soap-resolve-references-for-operation) - (put (aref (make-soap-binding) 0) 'soap-resolve-references + (put (soap-type-of (make-soap-binding)) 'soap-resolve-references 'soap-resolve-references-for-binding) - (put (aref (make-soap-port) 0) 'soap-resolve-references + (put (soap-type-of (make-soap-port)) 'soap-resolve-references 'soap-resolve-references-for-port)) (defun soap-wsdl-resolve-references (wsdl) @@ -2685,16 +2692,17 @@ soap-decode-type (cond ((listp type) (catch 'done (dolist (union-member type) - (let* ((decoder (get (aref union-member 0) + (let* ((decoder (get (soap-type-of union-member) 'soap-decoder)) (result (ignore-errors (funcall decoder union-member node)))) (when result (throw 'done result)))))) (t - (let ((decoder (get (aref type 0) 'soap-decoder))) + (let ((decoder (get (soap-type-of type) 'soap-decoder))) (cl-assert decoder nil - "no soap-decoder for %s type" (aref type 0)) + "no soap-decoder for %s type" + (soap-type-of type)) (funcall decoder type node)))))))))) (defun soap-decode-any-type (node) @@ -2878,9 +2886,9 @@ soap-encode-attributes Attributes are inserted in the current buffer at the current position." - (let ((attribute-encoder (get (aref type 0) 'soap-attribute-encoder))) + (let ((attribute-encoder (get (soap-type-of type) 'soap-attribute-encoder))) (cl-assert attribute-encoder nil - "no soap-attribute-encoder for %s type" (aref type 0)) + "no soap-attribute-encoder for %s type" (soap-type-of type)) (funcall attribute-encoder value type))) (defun soap-encode-value (value type) @@ -2892,8 +2900,8 @@ soap-encode-value is to be encoded. This is a generic function which finds an encoder function based on TYPE and calls that encoder to do the work." - (let ((encoder (get (aref type 0) 'soap-encoder))) - (cl-assert encoder nil "no soap-encoder for %s type" (aref type 0)) + (let ((encoder (get (soap-type-of type) 'soap-encoder))) + (cl-assert encoder nil "no soap-encoder for %s type" (soap-type-of type)) (funcall encoder value type)) (when (soap-element-namespace-tag type) (add-to-list 'soap-encoded-namespaces (soap-element-namespace-tag type)))) diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el index 050be45..252b1f3 100644 --- a/lisp/net/soap-inspect.el +++ b/lisp/net/soap-inspect.el @@ -49,10 +49,10 @@ soap-sample-value This is a generic function, depending on TYPE a specific function will be called." - (let ((sample-value (get (aref type 0) 'soap-sample-value))) + (let ((sample-value (get (soap-type-of type) 'soap-sample-value))) (if sample-value (funcall sample-value type) - (error "Cannot provide sample value for type %s" (aref type 0))))) + (error "Cannot provide sample value for type %s" (soap-type-of type))))) (defun soap-sample-value-for-xs-basic-type (type) "Provide a sample value for TYPE, an xs-basic-type. @@ -174,31 +174,31 @@ soap-sample-value-for-message (progn ;; Install soap-sample-value methods for our types - (put (aref (make-soap-xs-basic-type) 0) + (put (soap-type-of (make-soap-xs-basic-type)) 'soap-sample-value 'soap-sample-value-for-xs-basic-type) - (put (aref (make-soap-xs-element) 0) + (put (soap-type-of (make-soap-xs-element)) 'soap-sample-value 'soap-sample-value-for-xs-element) - (put (aref (make-soap-xs-attribute) 0) + (put (soap-type-of (make-soap-xs-attribute)) 'soap-sample-value 'soap-sample-value-for-xs-attribute) - (put (aref (make-soap-xs-attribute) 0) + (put (soap-type-of (make-soap-xs-attribute)) 'soap-sample-value 'soap-sample-value-for-xs-attribute-group) - (put (aref (make-soap-xs-simple-type) 0) + (put (soap-type-of (make-soap-xs-simple-type)) 'soap-sample-value 'soap-sample-value-for-xs-simple-type) - (put (aref (make-soap-xs-complex-type) 0) + (put (soap-type-of (make-soap-xs-complex-type)) 'soap-sample-value 'soap-sample-value-for-xs-complex-type) - (put (aref (make-soap-message) 0) + (put (soap-type-of (make-soap-message)) 'soap-sample-value 'soap-sample-value-for-message)) @@ -222,7 +222,7 @@ soap-inspect The buffer is populated with information about ELEMENT with links to its sub elements. If ELEMENT is the WSDL document itself, the entire WSDL can be inspected." - (let ((inspect (get (aref element 0) 'soap-inspect))) + (let ((inspect (get (soap-type-of element) 'soap-inspect))) (unless inspect (error "Soap-inspect: no inspector for element")) @@ -507,39 +507,39 @@ soap-inspect-wsdl (progn ;; Install the soap-inspect methods for our types - (put (aref (make-soap-xs-basic-type) 0) 'soap-inspect + (put (soap-type-of (make-soap-xs-basic-type)) 'soap-inspect 'soap-inspect-xs-basic-type) - (put (aref (make-soap-xs-element) 0) 'soap-inspect + (put (soap-type-of (make-soap-xs-element)) 'soap-inspect 'soap-inspect-xs-element) - (put (aref (make-soap-xs-simple-type) 0) 'soap-inspect + (put (soap-type-of (make-soap-xs-simple-type)) 'soap-inspect 'soap-inspect-xs-simple-type) - (put (aref (make-soap-xs-complex-type) 0) 'soap-inspect + (put (soap-type-of (make-soap-xs-complex-type)) 'soap-inspect 'soap-inspect-xs-complex-type) - (put (aref (make-soap-xs-attribute) 0) 'soap-inspect + (put (soap-type-of (make-soap-xs-attribute)) 'soap-inspect 'soap-inspect-xs-attribute) - (put (aref (make-soap-xs-attribute-group) 0) 'soap-inspect + (put (soap-type-of (make-soap-xs-attribute-group)) 'soap-inspect 'soap-inspect-xs-attribute-group) - (put (aref (make-soap-message) 0) 'soap-inspect + (put (soap-type-of (make-soap-message)) 'soap-inspect 'soap-inspect-message) - (put (aref (make-soap-operation) 0) 'soap-inspect + (put (soap-type-of (make-soap-operation)) 'soap-inspect 'soap-inspect-operation) - (put (aref (make-soap-port-type) 0) 'soap-inspect + (put (soap-type-of (make-soap-port-type)) 'soap-inspect 'soap-inspect-port-type) - (put (aref (make-soap-binding) 0) 'soap-inspect + (put (soap-type-of (make-soap-binding)) 'soap-inspect 'soap-inspect-binding) - (put (aref (make-soap-port) 0) 'soap-inspect + (put (soap-type-of (make-soap-port)) 'soap-inspect 'soap-inspect-port) - (put (aref (soap-make-wsdl "origin") 0) 'soap-inspect + (put (soap-type-of (soap-make-wsdl "origin")) 'soap-inspect 'soap-inspect-wsdl)) (provide 'soap-inspect) -- 1.8.3.1 --=-=-=--