gentoo/dev-python/fastbencode/files/fastbencode-0.3.1-cython-3.1.patch
Michał Górny 1bfea2a1bc
dev-python/fastbencode: Backport a patch for Cython-3.1 failures
Closes: https://bugs.gentoo.org/954095
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-04-21 17:43:43 +02:00

50 lines
1.5 KiB
Diff

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)