summaryrefslogtreecommitdiff
path: root/app-accessibility/brltty/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-10-10 12:09:13 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-10-10 12:09:13 +0100
commit35d60f48c1e8e3d48626e53a1933c55805177d20 (patch)
tree0754900eff547564866e4e7265a5f0789874f907 /app-accessibility/brltty/files
parentdd14643cac4a1aa6ce4151cea5c424577434968b (diff)
gentoo auto-resync : 10:10:2023 - 12:09:13
Diffstat (limited to 'app-accessibility/brltty/files')
-rw-r--r--app-accessibility/brltty/files/brltty-6.6-cython3.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/app-accessibility/brltty/files/brltty-6.6-cython3.patch b/app-accessibility/brltty/files/brltty-6.6-cython3.patch
new file mode 100644
index 000000000000..01a860a4d646
--- /dev/null
+++ b/app-accessibility/brltty/files/brltty-6.6-cython3.patch
@@ -0,0 +1,41 @@
+https://bugs.gentoo.org/913019
+https://github.com/brltty/brltty/commit/e6707d5e094dc36db4319ce4d052a6ad568a5d26
+
+From e6707d5e094dc36db4319ce4d052a6ad568a5d26 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date: Tue, 15 Aug 2023 16:29:13 +0200
+Subject: [PATCH] brlapi: Fix python crash on connection error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From Lukáš Tyrychtr:
+“
+Cython 3.0 started using the new Python object finalization APIs from PEP 442
+”
+
+This means that __del__ gets called even when raising an exception from
+__init__, while it was not before. To cope with both behaviors, we can
+set self.h to NULL to determine whether it still exists or not.
+
+Thanks Lukáš Tyrychtr for the investigation and patch draft!
+--- a/Bindings/Python/brlapi.pyx
++++ b/Bindings/Python/brlapi.pyx
+@@ -453,6 +453,7 @@ cdef class Connection:
+ c_brlapi.brlapi_protocolExceptionInit(self.h)
+ if self.fd == -1:
+ c_brlapi.free(self.h)
++ self.h = NULL
+ raise ConnectionError(self.settings.host, self.settings.auth)
+
+ def closeConnection(self):
+@@ -465,7 +466,8 @@ cdef class Connection:
+ """Release resources used by the connection"""
+ if self.fd != -1:
+ c_brlapi.brlapi__closeConnection(self.h)
+- c_brlapi.free(self.h)
++ if self.h != NULL:
++ c_brlapi.free(self.h)
+
+ property host:
+ """To get authorized to connect, libbrlapi has to tell the BrlAPI server a secret key, for security reasons. This is the path to the file which holds it; it will hence have to be readable by the application."""