guix/gnu/packages/patches/renpy-fix-integer-slots.patch
Liliana Marie Prikler 944d5bc08a
gnu: python-renpy: Update to 8.5.0.
* gnu/packages/patches/renpy-fix-integer-slots.patch: New file.
* gnu/packages/patches/renpy-python-3.11-compat.patch: New file.
* gnu/packages/patches/renpy-use-system-fribidi: Delete file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/game-development.scm (python-renpy): Update to 8.5.0.
[patches]: Use the new patches.
[snippet]: Adjust accordingly.
[build-system]: Switch to pyproject-build-system.
[#:phases]: Remove ‘relax-gcc-14-strictness’.
No longer replace ‘build’ and ‘install’.
Add ‘build-renpy’ and ‘install-renpy’.
[native-inputs]: Replace python-cython-0 with python-cython.
[inputs]: Add assimp.  Replace ffmpeg-6 with ffmpeg.
[propagated-inputs]: Remove python-pygame-sdl2.
2025-12-07 07:57:23 +01:00

40 lines
1.4 KiB
Diff

Index: renpy-8.5.0-source/renpy/cslots.pyx
===================================================================
--- renpy-8.5.0-source.orig/renpy/cslots.pyx
+++ renpy-8.5.0-source/renpy/cslots.pyx
@@ -32,6 +32,9 @@ Value unions, followed by a series of by
from cpython.mem cimport PyMem_Calloc, PyMem_Free
from cpython.object cimport PyObject, PyTypeObject, Py_TPFLAGS_HAVE_GC, PyObject_Free
from cpython.ref cimport Py_XINCREF, Py_XDECREF, Py_CLEAR
+cdef extern from "<limits.h>":
+ const long long LLONG_MIN
+ const long long LLONG_MAX
from copyreg import __newobj__
@@ -51,7 +54,7 @@ cdef unsigned char DEFAULT_VALUE = 0xff
cdef union Value:
PyObject *object
- unsigned long long integer
+ long long integer
cdef class CMetaclass(type):
@@ -369,10 +372,15 @@ cdef class IntegerSlot(Slot):
super(IntegerSlot, self).__init__(default_value)
self.default_int_value = default_value
- def __set__(self, CObject instance, unsigned int value):
+ def __set__(self, CObject instance, long long value):
cdef Value v
+ if value >= (LLONG_MAX >> 1):
+ raise OverflowError("Value is too large for an IntegerSlot")
+ if value <= (LLONG_MIN >> 1):
+ raise OverflowError("Value is too small for an IntegerSlot")
+
if value == self.default_int_value:
v.object = NULL
else: