8000 Merge pull request #17188 from timhoffm/backport-of-pr-16958-on-v3.2.x · matplotlib/matplotlib@5fc89c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5fc89c5

Browse files
authored
Merge pull request #17188 from timhoffm/backport-of-pr-16958-on-v3.2.x
Backport PR #16958: MAINT: Replace uses of tostring with tobytes
2 parents 964372c + d834d1c commit 5fc89c5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ def writeGouraudTriangles(self):
13941394
streamarr['points'] = (flat_points - points_min) * factor
13951395
streamarr['colors'] = flat_colors[:, :colordim] * 255.0
13961396

1397-
self.write(streamarr.tostring())
1397+
self.write(streamarr.tobytes())
13981398
self.endStream()
13991399
self.writeObject(self.gouraudObject, gouraudDict)
14001400

@@ -1487,7 +1487,7 @@ def _writeImg(self, data, height, width, grayscale, id, smask=None):
14871487
if png:
14881488
self._writePng(data)
14891489
else:
1490-
self.currentstream.write(data.tostring())
1490+
self.currentstream.write(data.tobytes())
14911491
self.endStream()
14921492

14931493
def writeImages(self):

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def draw_gouraud_triangles(self, gc, points, colors, trans):
694694
streamarr['points'] = (flat_points - points_min) * factor
695695
streamarr['colors'] = flat_colors[:, :3] * 255.0
696696

697-
stream = quote_ps_string(streamarr.tostring())
697+
stream = quote_ps_string(streamarr.tobytes())
698698

699699
self._pswriter.write(f"""\
700700
gsave

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def draw_image(self, gc, x, y, im):
288288
w = self.width
289289
h = self.height
290290
rows, cols = im.shape[:2]
291-
bitmap = wx.Bitmap.FromBufferRGBA(cols, rows, im.tostring())
291+
bitmap = wx.Bitmap.FromBufferRGBA(cols, rows, im.tobytes())
292292
gc = self.get_gc()
293293
gc.select()
294294
gc.gfx_ctx.DrawBitmap(bitmap, int(l), int(self.height - b),

0 commit comments

Comments
 (0)
0