Skip to content

Commit f794f68

Browse files
committed
Apply more fixes for python < 3.12 and fix actin
1 parent 873d419 commit f794f68

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

.github/workflows/build-ubuntu-debug-python.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ on:
1919
- '*.rst'
2020
- '*.md'
2121
- '.github/workflows/*.yml'
22-
# gcov/lcov only gets C coverage
23-
- 'src_py/**'
2422
# re-include current file to not be excluded
25-
- '!.github/workflows/build-ubuntu-coverage.yml'
23+
- '!.github/workflows/build-ubuntu-debug-python.yml'
2624

2725
pull_request:
2826
branches: main
@@ -47,7 +45,7 @@ jobs:
4745
fail-fast: false # if a particular matrix build fails, don't skip the rest
4846
matrix:
4947
os: [ ubuntu-24.04 ]
50-
python: [ 3.12.8 ]
48+
python: [ 3.11.11, 3.12.8 ]
5149

5250
env:
5351
# Pip now forces us to either make a venv or set this flag, so we will do
@@ -87,7 +85,7 @@ jobs:
8785
pyenv install ${{ matrix.python }} --debug --keep
8886
pyenv global ${{ matrix.python }}-debug
8987
echo $(python -VV)
90-
python dev.py build --lax
88+
python dev.py build
9189
9290
- name: Run tests
9391
env:

src_c/include/_pygame.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
#include "pgplatform.h"
5555
#include <Python.h>
5656

57+
static void
58+
shim_to_ignore_unused(void);
59+
5760
/* version macros (defined since version 1.9.5) */
5861
#ifndef PG_MAJOR_VERSION
5962
#error PG_MAJOR_VERSION must be defined
@@ -620,6 +623,9 @@ PYGAMEAPI_EXTERN_SLOTS(geometry);
620623
static PG_INLINE PyObject *
621624
pg_tuple_couple_from_values_int(int val1, int val2)
622625
{
626+
// I'm sorry for putting this here, but it just needs a place to go
627+
shim_to_ignore_unused();
628+
623629
/* This function turns two input integers into a python tuple object.
624630
* Currently, 5th November 2022, this is faster than using Py_BuildValue
625631
* to do the same thing.
@@ -742,6 +748,14 @@ pg_PointList_FromArrayDouble(double const *array, int arr_length)
742748
#if PY_MINOR_VERSION >= 13
743749
static PyObject *__cached_exception = NULL;
744750

751+
// this thing only exists because of the unused values that erroneously get
752+
// spit out by the compiler
753+
static void
754+
shim_to_ignore_unused(void)
755+
{
756+
(void)__cached_exception;
757+
}
758+
745759
#define CACHE_EXCEPTION __cached_exception = PyErr_GetRaisedException();
746760
#define RESTORE_EXCEPTION \
747761
{ \
@@ -754,6 +768,16 @@ static PyObject *__cached_type = NULL;
754768
static PyObject *__cached_value = NULL;
755769
static PyObject *__cached_traceback = NULL;
756770

771+
// this thing only exists because of the unused values that erroneously get
772+
// spit out by the compiler
773+
static void
774+
shim_to_ignore_unused(void)
775+
{
776+
(void)__cached_type;
777+
(void)__cached_value;
778+
(void)__cached_traceback;
779+
}
780+
757781
#define CACHE_EXCEPTION \
758782
PyErr_Fetch(&__cached_type, &__cached_value, &__cached_traceback);
759783
#define RESTORE_EXCEPTION \

src_c/mixer.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,9 +1200,6 @@ chan_set_volume(PyObject *self, PyObject *args)
12001200
{
12011201
int channelnum = pgChannel_AsInt(self);
12021202
float volume, stereovolume = -1.11f;
1203-
#ifdef Py_DEBUG
1204-
int result;
1205-
#endif
12061203
Uint8 left, right;
12071204
PyThreadState *_save;
12081205

@@ -1245,10 +1242,7 @@ chan_set_volume(PyObject *self, PyObject *args)
12451242
volume = 1.0f;
12461243
}
12471244

1248-
#ifdef Py_DEBUG
1249-
result =
1250-
#endif
1251-
Mix_Volume(channelnum, (int)(volume * 128));
1245+
Mix_Volume(channelnum, (int)(volume * 128));
12521246
Py_RETURN_NONE;
12531247
}
12541248

0 commit comments

Comments
 (0)