File: python-3.11.patch

package info (click to toggle)
cypari2 2.1.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,500 kB
  • sloc: python: 146,244; makefile: 35; ansic: 5
file content (40 lines) | stat: -rw-r--r-- 1,261 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Jerry James <loganjerry@gmail.com>
Date: Mon, 16 Nov 2020 08:59:54 -0700
Subject: Python 3.11 compatibility

Origin: upstream, https://github.com/sagemath/cypari2/pull/120/commits/e741737edceb9b1826121180c8e5be05c31f94ed
Bug-Debian: https://bugs.debian.org/1024064
---
 cypari2/convert.pyx | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/cypari2/convert.pyx b/cypari2/convert.pyx
index 1165031..587ecba 100644
--- a/cypari2/convert.pyx
+++ b/cypari2/convert.pyx
@@ -59,7 +59,7 @@ cdef extern from *:
     ctypedef struct PyLongObject:
         digit* ob_digit
 
-    Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object)
+    void __Pyx_SET_SIZE(object, Py_ssize_t)
 
 
 ########################################################################
@@ -450,13 +450,11 @@ cdef PyLong_FromINT(GEN g):
         if d:
             sizedigits_final = i+1
 
-    # Set correct size (use a pointer to hack around Cython's
-    # non-support for lvalues).
-    cdef Py_ssize_t* sizeptr = Py_SIZE_PTR(x)
+    # Set correct size
     if signe(g) > 0:
-        sizeptr[0] = sizedigits_final
+        __Pyx_SET_SIZE(x, sizedigits_final)
     else:
-        sizeptr[0] = -sizedigits_final
+        __Pyx_SET_SIZE(x, -sizedigits_final)
 
     return x