Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4d02bc9

Browse filesBrowse files
authored
Merge pull request #23440 from meeseeksmachine/auto-backport-of-pr-23430-on-v3.5.x
Backport PR #23430 on branch v3.5.x (Fix divide by 0 runtime warning)
2 parents 40544ec + 5f996de commit 4d02bc9
Copy full SHA for 4d02bc9

File tree

2 files changed

+7
-5
lines changed
Filter options

2 files changed

+7
-5
lines changed

‎lib/mpl_toolkits/mplot3d/proj3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/proj3d.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _line2d_seg_dist(p1, p2, p0):
2121

2222
x01 = np.asarray(p0[0]) - p1[0]
2323
y01 = np.asarray(p0[1]) - p1[1]
24-
if np.all(p1 == p2):
24+
if np.all(p1[0:2] == p2[0:2]):
2525
return np.hypot(x01, y01)
2626

2727
x21 = p2[0] - p1[0]

‎lib/mpl_toolkits/tests/test_mplot3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,11 +1004,13 @@ def test_lines_dists():
10041004
def test_lines_dists_nowarning():
10051005
# Smoke test to see that no RuntimeWarning is emitted when two first
10061006
# arguments are the same, see GH#22624
1007-
p0 = (10, 30)
1008-
p1 = (20, 150)
1009-
proj3d._line2d_seg_dist(p0, p0, p1)
1007+
p0 = (10, 30, 50)
1008+
p1 = (10, 30, 20)
1009+
p2 = (20, 150)
1010+
proj3d._line2d_seg_dist(p0, p0, p2)
1011+
proj3d._line2d_seg_dist(p0, p1, p2)
10101012
p0 = np.array(p0)
1011-
proj3d._line2d_seg_dist(p0, p0, p1)
1013+
proj3d._line2d_seg_dist(p0, p0, p2)
10121014

10131015

10141016
def test_autoscale():

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.