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 cada8fb

Browse filesBrowse files
authored
Merge pull request #23964 from oscargus/emprypsline
Fix issue with empty line in ps backend
2 parents 3637134 + da3790f commit cada8fb
Copy full SHA for cada8fb

File tree

Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,9 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
665665
curr_stream[1].append(
666666
(item.x, item.ft_object.get_glyph_name(item.glyph_idx))
667667
)
668-
# append the last entry
669-
stream.append(curr_stream)
668+
# append the last entry if exists
669+
if curr_stream:
670+
stream.append(curr_stream)
670671

671672
self.set_color(*gc.get_rgb())
672673

‎lib/matplotlib/tests/test_backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_ps.py
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,15 @@ def test_linedash():
256256
assert buf.tell() > 0
257257

258258

259+
def test_empty_line():
260+
# Smoke-test for gh#23954
261+
figure = Figure()
262+
figure.text(0.5, 0.5, "\nfoo\n\n")
263+
buf = io.BytesIO()
264+
figure.savefig(buf, format='eps')
265+
figure.savefig(buf, format='ps')
266+
267+
259268
def test_no_duplicate_definition():
260269

261270
fig = Figure()

0 commit comments

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