Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/cython/files/, dev-python/cython/
Date: Fri, 03 Sep 2021 18:18:22
Message-Id: 1630693096.7336b4f587b29d26018d925ed58f5aef503af218.mgorny@gentoo
1 commit: 7336b4f587b29d26018d925ed58f5aef503af218
2 Author: Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
3 AuthorDate: Fri Sep 3 13:15:19 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 3 18:18:16 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7336b4f5
7
8 dev-python/cython: fix unaligned accesses in type conversions
9
10 Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
11 Closes: https://github.com/gentoo/gentoo/pull/22204
12 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
13
14 ...hon-0.29.24.ebuild => cython-0.29.24-r1.ebuild} | 1 +
15 .../files/cython-0.29.24-unaligned-format.patch | 33 ++++++++++++++++++++++
16 2 files changed, 34 insertions(+)
17
18 diff --git a/dev-python/cython/cython-0.29.24.ebuild b/dev-python/cython/cython-0.29.24-r1.ebuild
19 similarity index 97%
20 rename from dev-python/cython/cython-0.29.24.ebuild
21 rename to dev-python/cython/cython-0.29.24-r1.ebuild
22 index 0c107a31d2b..dced6974732 100644
23 --- a/dev-python/cython/cython-0.29.24.ebuild
24 +++ b/dev-python/cython/cython-0.29.24-r1.ebuild
25 @@ -31,6 +31,7 @@ BDEPEND="${RDEPEND}
26 PATCHES=(
27 "${FILESDIR}/${PN}-0.29.22-spawn-multiprocessing.patch"
28 "${FILESDIR}/${PN}-0.29.23-test_exceptions-py310.patch"
29 + "${FILESDIR}/${PN}-0.29.24-unaligned-format.patch"
30 )
31
32 SITEFILE=50cython-gentoo.el
33
34 diff --git a/dev-python/cython/files/cython-0.29.24-unaligned-format.patch b/dev-python/cython/files/cython-0.29.24-unaligned-format.patch
35 new file mode 100644
36 index 00000000000..955c32debb4
37 --- /dev/null
38 +++ b/dev-python/cython/files/cython-0.29.24-unaligned-format.patch
39 @@ -0,0 +1,33 @@
40 +From 2c08fd50d62e4255602ee3c0d41157df7608e773 Mon Sep 17 00:00:00 2001
41 +From: Stefan Behnel <stefan_ml@××××××.de>
42 +Date: Wed, 1 Sep 2021 00:09:02 +0200
43 +Subject: [PATCH] Avoid copying unaligned 16-bit values since some platforms
44 + require them to be aligned. Use memcpy() instead to let the C compiler decide
45 + how to do it.
46 +
47 +Closes https://github.com/cython/cython/issues/4343
48 +---
49 + Cython/Utility/TypeConversion.c | 6 +++---
50 + 1 file changed, 3 insertions(+), 3 deletions(-)
51 +
52 +diff --git a/Cython/Utility/TypeConversion.c b/Cython/Utility/TypeConversion.c
53 +index 751d12b62a..3669bc9ec1 100644
54 +--- a/Cython/Utility/TypeConversion.c
55 ++++ b/Cython/Utility/TypeConversion.c
56 +@@ -829,14 +829,14 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t wid
57 + digit_pos = abs((int)(remaining % (8*8)));
58 + remaining = ({{TYPE}}) (remaining / (8*8));
59 + dpos -= 2;
60 +- *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_8)[digit_pos]; /* copy 2 digits at a time */
61 ++ memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); /* copy 2 digits at a time, unaligned */
62 + last_one_off = (digit_pos < 8);
63 + break;
64 + case 'd':
65 + digit_pos = abs((int)(remaining % (10*10)));
66 + remaining = ({{TYPE}}) (remaining / (10*10));
67 + dpos -= 2;
68 +- *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_10)[digit_pos]; /* copy 2 digits at a time */
69 ++ memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); /* copy 2 digits at a time, unaligned */
70 + last_one_off = (digit_pos < 10);
71 + break;
72 + case 'x':