Fix the Cython 3 crash and build with Cython 3 again

Thanks to Lukáš Tyrychtr and Samuel Thibault for the diagnosis
and fix.
This commit is contained in:
Adam Williamson 2023-08-15 09:35:12 -07:00
parent 7aab348118
commit ee571d6d47
2 changed files with 31 additions and 5 deletions

20
brltty-6.6-cython3.patch Normal file
View File

@ -0,0 +1,20 @@
--- python2/Bindings/Python/brlapi.pyx 2023-07-17 07:55:47.000000000 -0700
+++ python2/Bindings/Python/brlapi.pyx.new 2023-08-15 09:06:23.675136077 -0700
@@ -453,6 +453,7 @@
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 @@
"""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."""

View File

@ -47,7 +47,7 @@
Name: brltty
Version: 6.6
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPL-2.0-or-later
URL: http://brltty.app/
Source0: http://brltty.app/archive/%{name}-%{version}.tar.xz
@ -57,6 +57,10 @@ Source3: brlapi-forbuild.h
Patch1: brltty-6.3-loadLibrary.patch
# libspeechd.h moved in latest speech-dispatch (NOT sent upstream)
Patch2: brltty-6.3-libspeechd.patch
# https://brltty.app/pipermail/brltty/2023-August/020048.html
# thanks to Lukáš Tyrychtr for the diagnosis and initial patch, and
# Samuel Thibault for this improved patch
Patch3: brltty-6.6-cython3.patch
Summary: Braille display driver for Linux/Unix
BuildRequires: byacc
BuildRequires: glibc-kernheaders
@ -201,8 +205,7 @@ This package provides the Tcl binding for BrlAPI.
Version: %{api_version}
License: LGPL-2.0-or-later
Requires: brlapi%{?_isa} = %{api_version}-%{release}
# https://brltty.app/pipermail/brltty/2023-August/020039.html
BuildRequires: Cython < 3
BuildRequires: Cython
BuildRequires: python2-devel
BuildRequires: python2-setuptools
Summary: Python binding for BrlAPI
@ -216,8 +219,7 @@ This package provides the Python 2 binding for BrlAPI.
Version: %{api_version}
License: LGPL-2.0-or-later
Requires: brlapi%{?_isa} = %{api_version}-%{release}
# https://brltty.app/pipermail/brltty/2023-August/020039.html
BuildRequires: python3-Cython < 3
BuildRequires: python3-Cython
BuildRequires: python3-devel
%if %{without python2}
Obsoletes: python2-brlapi < %{api_version}-%{release}
@ -278,6 +280,7 @@ mv %{name}-%{version} python2
pushd python2
%patch -P 1 -p1 -b .loadLibrary
%patch -P 2 -p1 -b .libspeechd
%patch -P 3 -p1 -b .cython3
# remove packaged binary file
rm -f Programs/brltty-ktb
@ -691,6 +694,9 @@ fi
%config(noreplace) %verify(not size md5 mtime) %{_sysconfdir}/brltty/Initramfs/cmdline
%changelog
* Tue Aug 15 2023 Adam Williamson <awilliam@redhat.com> - 6.6-4
- Fix the Cython 3 crash and build with Cython 3 again
* Mon Aug 14 2023 Adam Williamson <awilliam@redhat.com> - 6.6-3
- Build with Cython 0.29, it crashes when built with Cython 3 (#2231865)