summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-08-06 09:24:35 +0200
committerMichał Górny <mgorny@gentoo.org>2023-08-06 09:47:44 +0200
commitbe89891c1b251b307ab3182054abaf276810aab6 (patch)
tree44bea9c0b03a1d6de16d5b9e36d114879157a21c /dev-python/fastbencode
parentdev-python/fastbencode: Fix testing the C ext, remove broken py3.12 (diff)
downloadgentoo-be89891c1b251b307ab3182054abaf276810aab6.tar.gz
gentoo-be89891c1b251b307ab3182054abaf276810aab6.tar.bz2
gentoo-be89891c1b251b307ab3182054abaf276810aab6.zip
dev-python/fastbencode: Backport py3.12 fix
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/fastbencode')
-rw-r--r--dev-python/fastbencode/fastbencode-0.2.ebuild7
-rw-r--r--dev-python/fastbencode/files/fastbencode-0.2-py312.patch35
2 files changed, 41 insertions, 1 deletions
diff --git a/dev-python/fastbencode/fastbencode-0.2.ebuild b/dev-python/fastbencode/fastbencode-0.2.ebuild
index f884ac6d4ab5..068bcff75e2d 100644
--- a/dev-python/fastbencode/fastbencode-0.2.ebuild
+++ b/dev-python/fastbencode/fastbencode-0.2.ebuild
@@ -5,7 +5,7 @@ EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_COMPAT=( python3_{10..12} )
inherit distutils-r1 pypi
@@ -25,6 +25,11 @@ BDEPEND="
distutils_enable_tests unittest
+PATCHES=(
+ # https://github.com/breezy-team/fastbencode/commit/23e8cadcc81c6649d96742f235a98bd3047e5d8a
+ "${FILESDIR}"/${P}-py312.patch
+)
+
python_test() {
cd fastbencode/tests || die
eunittest
diff --git a/dev-python/fastbencode/files/fastbencode-0.2-py312.patch b/dev-python/fastbencode/files/fastbencode-0.2-py312.patch
new file mode 100644
index 000000000000..78c42c7b2fa7
--- /dev/null
+++ b/dev-python/fastbencode/files/fastbencode-0.2-py312.patch
@@ -0,0 +1,35 @@
+From 23e8cadcc81c6649d96742f235a98bd3047e5d8a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= <jelmer@jelmer.uk>
+Date: Tue, 11 Jul 2023 11:45:47 +0000
+Subject: [PATCH] Fix compatibility with python 3.12
+
+Fixes #23
+---
+ fastbencode/tests/test_bencode.py | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/fastbencode/tests/test_bencode.py b/fastbencode/tests/test_bencode.py
+index 50e8e06..61cd8b5 100644
+--- a/fastbencode/tests/test_bencode.py
++++ b/fastbencode/tests/test_bencode.py
+@@ -287,10 +287,16 @@ def test_list(self):
+
+ def test_list_deepnested(self):
+ import platform
+- if platform.python_implementation() == 'PyPy':
+- self.skipTest('recursion not an issue on pypy')
+- with RecursionLimit():
+- self._run_check_error(RuntimeError, (b"l" * 100) + (b"e" * 100))
++ if (platform.python_implementation() == 'PyPy'
++ or sys.version_info[:2] >= (3, 12)):
++ expected = []
++ for i in range(99):
++ expected = [expected]
++ self._check(expected, (b"l" * 100) + (b"e" * 100))
++ else:
++ with RecursionLimit():
++ self._run_check_error(
++ RuntimeError, (b"l" * 100) + (b"e" * 100))
+
+ def test_malformed_list(self):
+ self._run_check_error(ValueError, b'l')