Hello to all.
I've successfully tracked the reason for the brlapi crash under Cython
3.0, or at least it is the only one.
Cython 3.0 started using the new Python object finalization APIs from
PEP 442, and it likely changed the semantics about what gets called when
a constructor throws an exception. Now, the __del__ method gets invoked
in this case as well, but the Connection's one freed the handle even if
self.fd was -1, so it did a double free, as before throwing the
COnnectionError, the thing gets freed the first time.
Attached is a patch fixing this issue by freeing the handle only when it
is safe to do so.
Regards,
Lukáš Tyrychtr
diff --git a/Bindings/Python/brlapi.pyx b/Bindings/Python/brlapi.pyx
index 0136895ea..77b1eea42 100644
--- a/Bindings/Python/brlapi.pyx
+++ b/Bindings/Python/brlapi.pyx
@@ -465,7 +465,7 @@ cdef class Connection:
"""Release resources used by the connection"""
if self.fd != -1:
c_brlapi.brlapi__closeConnection(self.h)
- c_brlapi.free(self.h)
+ 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."""
_______________________________________________
This message was sent via the BRLTTY mailing list.
To post a message, send an e-mail to: [email protected]
For general information, go to: http://brltty.app/mailman/listinfo/brltty