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
41
42
43
44
45
46
47
48
49
|
From 287a8ae762fd3e6d532cda7b899d08ec9859f84a Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@jelmer.uk>
Date: Mon, 21 Apr 2025 12:33:50 +0000
Subject: [PATCH] Fix compatibility with Cython 3.1. Fixes #96
---
fastbencode/_bencode_pyx.pyx | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/fastbencode/_bencode_pyx.pyx b/fastbencode/_bencode_pyx.pyx
index 651f09f..c526b19 100644
--- a/fastbencode/_bencode_pyx.pyx
+++ b/fastbencode/_bencode_pyx.pyx
@@ -31,16 +31,13 @@ from cpython.bytes cimport (
from cpython.dict cimport (
PyDict_CheckExact,
)
-from cpython.int cimport (
- PyInt_CheckExact,
- PyInt_FromString,
- )
from cpython.list cimport (
PyList_CheckExact,
PyList_Append,
)
from cpython.long cimport (
PyLong_CheckExact,
+ PyLong_FromString,
)
from cpython.mem cimport (
PyMem_Free,
@@ -165,7 +162,7 @@ cdef class Decoder:
i = self._read_digits(c'e')
self.tail[i] = 0
try:
- ret = PyInt_FromString(self.tail, NULL, 10)
+ ret = PyLong_FromString(self.tail, NULL, 10)
finally:
self.tail[i] = c'e'
D_UPDATE_TAIL(self, i+1)
@@ -414,7 +411,7 @@ cdef class Encoder:
try:
if PyBytes_CheckExact(x):
self._encode_bytes(x)
- elif PyInt_CheckExact(x) and x.bit_length() < 32:
+ elif PyLong_CheckExact(x) and x.bit_length() < 32:
self._encode_int(x)
elif PyLong_CheckExact(x):
self._encode_long(x)
|