File: numpy_2.3_stroke.patch

package info (click to toggle)
mypaint 2.0.1-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,884 kB
  • sloc: python: 43,893; cpp: 6,931; xml: 2,475; sh: 473; makefile: 25
file content (35 lines) | stat: -rw-r--r-- 1,342 bytes parent folder | download
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
Forwarded: not-needed
Origin: https://github.com/mypaint/mypaint/commit/ab017e073e83a4930a0fb09608682bf4b7ab1874

From ab017e073e83a4930a0fb09608682bf4b7ab1874 Mon Sep 17 00:00:00 2001
From: askmeaboutlo0m <askmeaboutlo0m@users.noreply.github.com>
Date: Mon, 23 Jun 2025 15:51:28 +0200
Subject: [PATCH] Replace tostring() with tobytes() in stroke.py (#1300)

Because numpy removed the former function (in a minor release) with
numpy/numpy#28254. The function was an alias, so there's no change in
behavior, i.e. it always returned bytes.

See also 2a92b6baf452aba2cff3cc0a7782b301da3933d7, where the same
function was already replaced in strokemap.py.

--- a/lib/stroke.py
+++ b/lib/stroke.py
@@ -43,7 +43,7 @@
 
         states = brush.get_states_as_array()
         assert states.dtype == 'float32'
-        self.brush_state = states.tostring()
+        self.brush_state = states.tobytes()
 
         self.brush = brush
         self.brush.new_stroke()  # resets the stroke_* members of the brush
@@ -63,7 +63,7 @@
         # - for space: just gzip? use integer datatypes?
         # - for time: maybe already use array storage while recording?
         data = np.array(self.tmp_event_list, dtype='float64')
-        data = data.tostring()
+        data = data.tobytes()
         version = b'2'
         self.stroke_data = version + data