Merge ~ahasenack/ubuntu/+source/pyx3:jammy-pyx3-sizet into ubuntu/+source/pyx3:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Merged at revision: 75af35f2169732d26304436be24904b905d0cdb1
Proposed branch: ~ahasenack/ubuntu/+source/pyx3:jammy-pyx3-sizet
Merge into: ubuntu/+source/pyx3:ubuntu/devel
Diff against target: 110 lines (+78/-1)
4 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/py310-py_ssize_t_clean.patch (+68/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Utkarsh Gupta (community) Approve
Canonical Server Pending
Review via email: mp+415156@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

+1, looks good.

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks, uploaded

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index c6e9bff..9d838e3 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+pyx3 (0.15-5ubuntu1) jammy; urgency=medium
7+
8+ * d/p/py310-py_ssize_t_clean.patch: fix t1 extension with Python 3.10
9+ (LP: #1960092)
10+
11+ -- Andreas Hasenack <andreas@canonical.com> Sat, 05 Feb 2022 18:25:58 +0000
12+
13 pyx3 (0.15-5) unstable; urgency=medium
14
15 * Use lintian-brush/janitor to update packaging:
16diff --git a/debian/control b/debian/control
17index b293854..f62f59d 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,5 +1,6 @@
21 Source: pyx3
22-Maintainer: Stuart Prescott <stuart@debian.org>
23+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
24+XSBC-Original-Maintainer: Stuart Prescott <stuart@debian.org>
25 Standards-Version: 4.6.0
26 Section: python
27 Priority: optional
28diff --git a/debian/patches/py310-py_ssize_t_clean.patch b/debian/patches/py310-py_ssize_t_clean.patch
29new file mode 100644
30index 0000000..e974e86
31--- /dev/null
32+++ b/debian/patches/py310-py_ssize_t_clean.patch
33@@ -0,0 +1,68 @@
34+From 0f2834330f7c86dbb5de9f75f9c7c8b7ab4ebabf Mon Sep 17 00:00:00 2001
35+From: Michael J Gruber <git@grubix.eu>
36+Date: Mon, 15 Nov 2021 10:38:13 +0100
37+Subject: [PATCH] fix t1 extension with Python 3.10
38+
39+For all # variants of formats (s#, y#, etc.), the macro PY_SSIZE_T_CLEAN
40+must be defined before including Python.h. On Python 3.9 and older, the
41+type of the length argument is Py_ssize_t if the PY_SSIZE_T_CLEAN macro
42+is defined, or int otherwise. [https://docs.python.org/3.10/c-api/arg.html]
43+
44+So, on Python 3.9, PyX worked because PY_SSIZE_T_CLEAN was not defined
45+(even though it was recommended), so that the deprecated return type of
46+int (for the string length) was used.
47+
48+Python 3.10 finally pulls the trigger on the ints, so finally adjust to
49+that announced change.
50+---
51+ CHANGES | 4 +++-
52+ pyx/font/_t1code.c | 12 ++++++++----
53+ 2 files changed, 11 insertions(+), 5 deletions(-)
54+
55+Origin: upstream, https://github.com/pyx-project/pyx/commit/0f2834330f7c86dbb5de9f75f9c7c8b7ab4ebabf
56+Bug-Debian: https://bugs.debian.org/1005028
57+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/pyx3/+bug/1960092
58+Last-Update: 2022-02-05
59+diff --git a/pyx/font/_t1code.c b/pyx/font/_t1code.c
60+index d8ecc173..eacb3fa1 100644
61+--- a/pyx/font/_t1code.c
62++++ b/pyx/font/_t1code.c
63+@@ -10,6 +10,8 @@
64+ * USA.
65+ */
66+
67++#define PY_SSIZE_T_CLEAN
68++
69+ #include <Python.h>
70+ #include <stdlib.h>
71+ #include <stdint.h>
72+@@ -32,11 +34,12 @@ def decoder(code, r, n):
73+ static PyObject *py_decoder(PyObject *self, PyObject *args)
74+ {
75+ unsigned char *code;
76+- int lcode, pr, n;
77++ Py_ssize_t lcode;
78++ int pr, n;
79+
80+ if (PyArg_ParseTuple(args, "y#ii", (char **) &code, &lcode, &pr, &n)) {
81+ unsigned char *data;
82+- int i;
83++ Py_ssize_t i;
84+ unsigned char x;
85+ uint16_t r=pr;
86+ PyObject *result;
87+@@ -74,11 +77,12 @@ static PyObject *py_encoder(PyObject *self, PyObject *args)
88+ {
89+ unsigned char *data;
90+ unsigned char *random;
91+- int ldata, pr, lrandom;
92++ Py_ssize_t ldata, lrandom;
93++ int pr;
94+
95+ if (PyArg_ParseTuple(args, "y#iy#", (char **) &data, &ldata, &pr, (char **) &random, &lrandom)) {
96+ unsigned char *code;
97+- int i;
98++ Py_ssize_t i;
99+ uint16_t r=pr;
100+ PyObject *result;
101+
102diff --git a/debian/patches/series b/debian/patches/series
103index 480588f..924b746 100644
104--- a/debian/patches/series
105+++ b/debian/patches/series
106@@ -10,3 +10,4 @@ reproducible-timestamps.patch
107 reproducible-image-name.patch
108 reproducible-elements.patch
109 texlive2020-horiz-alignment.patch
110+py310-py_ssize_t_clean.patch

Subscribers

People subscribed via source and target branches