Skip to content

Commit 94370b6

Browse files
authored
Update python versions in run-ubuntu-checks workflow, and fix faulty refcounting in rect clipline (pygame-community#3548)
* Updated patch versions of 3.9 and 3.13 in run-ubuntu-checks and added 3.14.0rc1 * Removed faulty xdecref for rect/frect * Re-added XDECREF in rect clipline, but decref'ing the correct object
1 parent aa03f38 commit 94370b6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/workflows/run-ubuntu-checks.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ jobs:
5353
os: [ ubuntu-24.04 ]
5454
# check our min python (minor) version and our max python (minor) version
5555
python: [
56-
3.9.21,
57-
3.13.1
56+
3.9.23,
57+
3.13.5,
58+
3.14.0rc1
5859
]
5960

6061
env:

src_c/rect_impl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,7 @@ RectExport_clip(RectObject *self, PyObject *const *args, Py_ssize_t nargs)
18691869
static PyObject *
18701870
RectExport_clipline(RectObject *self, PyObject *const *args, Py_ssize_t nargs)
18711871
{
1872+
PyObject *outer_rect = NULL;
18721873
InnerRect *rect = &self->r, *rect_copy = NULL;
18731874
PrimitiveType x1, y1, x2, y2;
18741875

@@ -1918,7 +1919,8 @@ RectExport_clipline(RectObject *self, PyObject *const *args, Py_ssize_t nargs)
19181919

19191920
if ((self->r.w < 0) || (self->r.h < 0)) {
19201921
/* Make a copy of the rect so it can be normalized. */
1921-
rect_copy = &pgRectAsRect(RectExport_RectNew(&self->r));
1922+
outer_rect = RectExport_RectNew(&self->r);
1923+
rect_copy = &pgRectAsRect(outer_rect);
19221924

19231925
if (rect_copy == NULL) {
19241926
return RAISE(PyExc_MemoryError, "cannot allocate memory for rect");
@@ -1929,11 +1931,11 @@ RectExport_clipline(RectObject *self, PyObject *const *args, Py_ssize_t nargs)
19291931
}
19301932

19311933
if (!RectImport_IntersectRectAndLine(rect, &x1, &y1, &x2, &y2)) {
1932-
Py_XDECREF(rect_copy);
1934+
Py_XDECREF(outer_rect);
19331935
return PyTuple_New(0);
19341936
}
19351937

1936-
Py_XDECREF(rect_copy);
1938+
Py_XDECREF(outer_rect);
19371939

19381940
PyObject *subtup1, *subtup2;
19391941
subtup1 = TupleFromTwoPrimitives(x1, y1);

0 commit comments

Comments
 (0)