Your message dated Sat, 27 Nov 2021 19:17:32 +0000
with message-id <2ae5befc-4649-5a47-0b23-4edf7b338...@debian.org>
and subject line pygame: FTBFS with python3.10
has caused the Debian Bug report #1000237,
regarding pygame: FTBFS with python3.10
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1000237: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000237
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: pygame
Version: 1.9.6+dfsg-4
Severity: serious
Tags: patch
Justification: FTBFS
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu jammy ubuntu-patch

Dear maintainers,

Now that python3.10 is a supported python version in unstable, pygame fails
to build from source.

I wasn't able to find a direct fix for these issues in the upstream git, so
I've prepared the attached patch instead.  I've uploaded this patch to
Ubuntu to fix the failure in question.  Please consider including it in
Debian as well.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru pygame-1.9.6+dfsg/debian/patches/python-3.10.patch 
pygame-1.9.6+dfsg/debian/patches/python-3.10.patch
--- pygame-1.9.6+dfsg/debian/patches/python-3.10.patch  1969-12-31 
16:00:00.000000000 -0800
+++ pygame-1.9.6+dfsg/debian/patches/python-3.10.patch  2021-11-19 
17:24:50.000000000 -0800
@@ -0,0 +1,115 @@
+Description: fix compatibility with python 3.10
+ Python 3.10 requires use of Py_ssize_t instead of int.
+ Also, certain math operations are now returning floats instead of ints,
+ so adjust.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Update: 2021-11-19
+
+Index: pygame-1.9.6+dfsg/src_c/mixer.c
+===================================================================
+--- pygame-1.9.6+dfsg.orig/src_c/mixer.c
++++ pygame-1.9.6+dfsg/src_c/mixer.c
+@@ -24,6 +24,7 @@
+  *  mixer module for pygame
+  */
+ #define PYGAMEAPI_MIXER_INTERNAL
++#define PY_SSIZE_T_CLEAN
+ #include "pygame.h"
+ 
+ #include "pgcompat.h"
+@@ -529,7 +530,7 @@
+ {
+     static char *kwids[] = {"frequency", "size",       "channels",
+                             "buffer",    "devicename", "allowedchanges", 
NULL};
+-    int dname_size = 0;
++    Py_ssize_t dname_size = 0;
+ 
+     request_frequency = 0;
+     request_size = 0;
+Index: pygame-1.9.6+dfsg/src_c/sdlmain_osx.m
+===================================================================
+--- pygame-1.9.6+dfsg.orig/src_c/sdlmain_osx.m
++++ pygame-1.9.6+dfsg/src_c/sdlmain_osx.m
+@@ -19,6 +19,7 @@
+ 
+ /* Mac OS X functions to accommodate the fact SDLMain.m is not included */
+ 
++#define PY_SSIZE_T_CLEAN
+ #include "pygame.h"
+ 
+ #include <Carbon/Carbon.h>
+@@ -234,7 +235,7 @@
+ _InstallNSApplication(PyObject* self, PyObject* arg)
+ {
+     char* icon_data = NULL;
+-    int data_len = 0;
++    Py_ssize_t data_len = 0;
+     PYGPYGSDLApplicationDelegate *sdlApplicationDelegate = NULL;
+ 
+     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+Index: pygame-1.9.6+dfsg/src_c/overlay.c
+===================================================================
+--- pygame-1.9.6+dfsg.orig/src_c/overlay.c
++++ pygame-1.9.6+dfsg/src_c/overlay.c
+@@ -23,6 +23,7 @@
+  * Dmitry Borisov
+  */
+ 
++#define PY_SSIZE_T_CLEAN
+ #include <Python.h>
+ 
+ #include "pygame.h"
+@@ -67,7 +68,8 @@
+ {
+     SDL_Rect cRect;
+     // Parse data params for frame
+-    int ls_y, ls_u, ls_v, y;
++    Py_ssize_t ls_y, ls_u, ls_v;
++    int y;
+     unsigned char *src_y = 0, *src_u = 0, *src_v = 0;
+ 
+     if (PyTuple_Size(args)) {
+Index: pygame-1.9.6+dfsg/src_c/scrap.c
+===================================================================
+--- pygame-1.9.6+dfsg.orig/src_c/scrap.c
++++ pygame-1.9.6+dfsg/src_c/scrap.c
+@@ -28,6 +28,7 @@
+ 
+ #include "SDL_syswm.h"
+ 
++#define PY_SSIZE_T_CLEAN
+ #include "scrap.h"
+ 
+ #include "pygame.h"
+@@ -276,7 +277,7 @@
+ static PyObject *
+ _scrap_put_scrap(PyObject *self, PyObject *args)
+ {
+-    int scraplen;
++    Py_ssize_t scraplen;
+     char *scrap = NULL;
+     char *scrap_type;
+     PyObject *tmp;
+Index: pygame-1.9.6+dfsg/src_py/sprite.py
+===================================================================
+--- pygame-1.9.6+dfsg.orig/src_py/sprite.py
++++ pygame-1.9.6+dfsg/src_py/sprite.py
+@@ -1346,14 +1346,14 @@
+         leftrect = left.rect
+         width = leftrect.width
+         height = leftrect.height
+-        leftrect = leftrect.inflate(width * ratio - width,
+-                                    height * ratio - height)
++        leftrect = leftrect.inflate(int(width * ratio - width),
++                                    int(height * ratio - height))
+ 
+         rightrect = right.rect
+         width = rightrect.width
+         height = rightrect.height
+-        rightrect = rightrect.inflate(width * ratio - width,
+-                                      height * ratio - height)
++        rightrect = rightrect.inflate(int(width * ratio - width),
++                                      int(height * ratio - height))
+ 
+         return leftrect.colliderect(rightrect)
+ 
diff -Nru pygame-1.9.6+dfsg/debian/patches/series 
pygame-1.9.6+dfsg/debian/patches/series
--- pygame-1.9.6+dfsg/debian/patches/series     2020-10-18 08:08:21.000000000 
-0700
+++ pygame-1.9.6+dfsg/debian/patches/series     2021-11-19 16:08:50.000000000 
-0800
@@ -14,3 +14,4 @@
 python3.9-is_alive.patch
 python3.9-array.tostring.patch
 sphinx3.patch
+python-3.10.patch

--- End Message ---
--- Begin Message ---
Version: 1.9.6+dfsg-5

The changelog has

* Patch: Python 3.10 support.

And the package built successfully on all release architectures.


--- End Message ---

Reply via email to