File: octave7.patch

package info (click to toggle)
octave-interval 3.2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,580 kB
  • sloc: ansic: 31,664; sh: 3,708; cpp: 2,958; objc: 1,662; makefile: 243; xml: 58; sed: 8
file content (113 lines) | stat: -rw-r--r-- 3,266 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Description: Fix FTBFS against Octave 7
Origin: upstream, https://sourceforge.net/p/octave/interval/ci/d3d6819e990eba8bf6363bc9f2d3d2cc78dcff03/
Bug: https://savannah.gnu.org/bugs/?61898
Bug-Debian: https://bugs.debian.org/1009132
Reviewed-by: Sébastien Villemot <sebastien@debian.org>
Last-Update: 2022-04-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/doc/NEWS.texinfo
+++ b/doc/NEWS.texinfo
@@ -15,6 +15,14 @@
 @center GNU Octave Interval Package
 @center Summary of important user-visible changes
 
+@release{3.2.2, XXXX-XX-XX}
+
+@itemize
+@item
+    subsref: Access to interval properties using field syntax, e. g., @code{x.inf} and @code{x.sup}, has been fixed for Octave 7 and later (bug #61898).
+
+@end itemize
+
 @release{3.2.1, 2022-01-28}
 This bugfix release fixes compatibility issues with new versions of GNU Octave.
 
@@ -33,8 +41,6 @@ This bugfix release fixes compatibility
     Interval constants for @code{pi} and @code{e} in Octave 7 and later have been fixed.  This also fixes several trigonometric functions, which have produced wrong results in Octave 7.
 @item
     Compilation errors during package installation with Octave 8 and later have been fixed (bug #61568).
-@item
-
 @end itemize
 
 
--- a/inst/@infsup/subsref.m
+++ b/inst/@infsup/subsref.m
@@ -52,7 +52,7 @@
 ## Keywords: interval
 ## Created: 2014-10-29
 
-function A = subsref (A, S)
+function varargout = subsref (A, S)
 
   if (nargin ~= 2)
     print_usage ();
@@ -89,19 +89,27 @@ function A = subsref (A, S)
     A = subsref (A, S(2 : end));
   endif
 
+  # Since Octave 7 it is possible that "." indexing produces a list of outputs;
+  # one for each element in the non-scalar object.
+  # We don't need that feature yet, because we always return a single object.
+  # However, we must declare a varargout return value to prevent runtime errors (bug #61898).
+  varargout = {A};
+
 endfunction
 
 %!assert (infsup (magic (3))([1, 2, 3]) == magic (3)([1, 2, 3]));
 
-%!# from the documentation string
 %!test
 %! x = infsup (magic (3), magic (3) + 1);
 %! assert (x(1) == infsup (8, 9));
+
+%!test
+%! x = infsup (magic (3), magic (3) + 1);
 %! assert (x(:, 2) == infsup ([1; 5; 9], [2; 6; 10]));
 
 %!assert (infsup (3).inf, 3);
 
-%!xtest <61898>
+%!test
 %! x = infsup (magic (3), magic (3) + 1);
 %! assert (x.inf, magic (3));
 
--- a/inst/@infsupdec/subsref.m
+++ b/inst/@infsupdec/subsref.m
@@ -53,7 +53,7 @@
 ## Keywords: interval
 ## Created: 2014-11-02
 
-function A = subsref (A, S)
+function varargout = subsref (A, S)
 
   if (nargin ~= 2)
     print_usage ();
@@ -97,19 +97,24 @@ function A = subsref (A, S)
     A = subsref (A, S(2 : end));
   endif
 
+  # See @infsup/subsref about why we need varargout.
+  varargout = {A};
+
 endfunction
 
 %!assert (isequal (infsupdec (magic (3))([1, 2, 3]), infsupdec (magic (3)([1, 2, 3]))));
 
-%!# from the documentation string
 %!test
 %! x = infsupdec (magic (3), magic (3) + 1);
 %! assert (x(1) == infsupdec (8, 9));
+
+%!test
+%! x = infsupdec (magic (3), magic (3) + 1);
 %! assert (x(:, 2) == infsupdec ([1; 5; 9], [2; 6; 10]));
 
 %!assert (infsupdec (3).inf, 3);
 
-%!xtest <61898>
+%!test
 %! x = infsupdec (magic (3), magic (3) + 1);
 %! assert (x.inf, magic (3));