Skip to content

Commit 238b1dc

Browse files
author
Release Manager
committed
gh-36255: numpy-1.25 compatibility Fixes two doctest failures with numpy-1.25.x. One is a warning from pythran that needs to be hidden (to avoid requiring a bleeding-edge version of pythran), and the other is a buggy doctest that now triggers a numpy warning. URL: #36255 Reported by: Michael Orlitzky Reviewer(s):
2 parents 486d3b9 + 63edc00 commit 238b1dc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/sage/doctest/parsing.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,17 @@ def do_fixup(self, want, got):
16311631
got = ld_pie_warning_regex.sub('', got)
16321632
did_fixup = True
16331633

1634+
if "Overriding pythran description" in got:
1635+
# Some signatures changed in numpy-1.25.x that may yet be
1636+
# reverted, but which pythran would otherwise warn about.
1637+
# Pythran has a special case for numpy.random that hides
1638+
# the warning -- I guess until we know if the changes will
1639+
# be reverted -- but only in v0.14.0 of pythran. Ignoring
1640+
# This warning allows us to support older pythran with e.g.
1641+
# numpy-1.25.2.
1642+
pythran_numpy_warning_regex = re.compile(r'WARNING: Overriding pythran description with argspec information for: numpy\.random\.[a-z_]+')
1643+
got = pythran_numpy_warning_regex.sub('', got)
1644+
did_fixup = True
16341645
return did_fixup, want, got
16351646

16361647
def output_difference(self, example, got, optionflags):

src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@
134134
sage: t = srange(0, 5, 0.1); p = Graphics()
135135
sage: for k in srange(0, 10, 0.15):
136136
....: y = integrate.odeint(f, k, t)
137-
....: p += line(zip(t, flatten(y)))
137+
....: p += line(zip(t, flatten(y.tolist())))
138138
sage: t = srange(0, -5, -0.1); q = Graphics()
139139
sage: for k in srange(0, 10, 0.15):
140140
....: y = integrate.odeint(f, k, t)
141-
....: q += line(zip(t, flatten(y)))
141+
....: q += line(zip(t, flatten(y.tolist())))
142142
sage: y = var('y')
143143
sage: v = plot_vector_field((1, -cos(x*y)), (x,-5,5), (y,-2,11))
144144
sage: g = p + q + v; g.show()

0 commit comments

Comments
 (0)