diff --git a/Inline-Python-0.56-Use-python3.patch b/Inline-Python-0.56-Use-python3.patch deleted file mode 100644 index bc16e6a..0000000 --- a/Inline-Python-0.56-Use-python3.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up Inline-Python-0.56/Makefile.PL.orig Inline-Python-0.56/Makefile.PL ---- Inline-Python-0.56/Makefile.PL.orig 2018-07-09 12:54:47.605495856 +0200 -+++ Inline-Python-0.56/Makefile.PL 2018-07-09 12:55:15.919418183 +0200 -@@ -22,7 +22,7 @@ unless ($sel) { - my $sep = $^O eq 'MSWin32' ? ";" : ":"; - for $p (split /$sep/, $ENV{PATH}) { - $p =~ s/^~/$ENV{HOME}/; -- $p .= "/python"; -+ $p .= "/python3"; - next unless -f $p and -x $p; - next if $pythons{abs_path($p)}++; # filter symlinked duplicates - push @pythons, { path => $p }; diff --git a/perl-Inline-Python-pyinit.patch b/perl-Inline-Python-pyinit.patch new file mode 100644 index 0000000..300f34e --- /dev/null +++ b/perl-Inline-Python-pyinit.patch @@ -0,0 +1,47 @@ +From 90b68bdf370c07b1d3fdd46bbdf1b154ed74b91b Mon Sep 17 00:00:00 2001 +From: Mattias Ellert +Date: Wed, 18 Aug 2021 16:41:10 +0200 +Subject: [PATCH] Call Py_Initialize() before calling PyBytes_FromString() + +Not doing this gives a segmentation fault with Python 3.10 +--- + Python.xs | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Python.xs b/Python.xs +index 11d5033..7a3c793 100644 +--- a/Python.xs ++++ b/Python.xs +@@ -25,14 +25,6 @@ void do_pyinit() { + #ifdef EXPOSE_PERL + PyObject *main_dict; + PyObject *perl_obj; +- +-#if PY_MAJOR_VERSION >= 3 +- PyObject *dummy1 = PyBytes_FromString(""), +- *dummy2 = PyBytes_FromString("main"); +-#else +- PyObject *dummy1 = PyString_FromString(""), +- *dummy2 = PyString_FromString("main"); +-#endif + #endif + /* sometimes Python needs to know about argc and argv to be happy */ + int _python_argc = 1; +@@ -48,6 +40,14 @@ void do_pyinit() { + PySys_SetArgv(_python_argc, _python_argv); /* Tk needs this */ + + #ifdef EXPOSE_PERL ++#if PY_MAJOR_VERSION >= 3 ++ PyObject *dummy1 = PyBytes_FromString(""), ++ *dummy2 = PyBytes_FromString("main"); ++#else ++ PyObject *dummy1 = PyString_FromString(""), ++ *dummy2 = PyString_FromString("main"); ++#endif ++ + /* create the perl module and add functions */ + initperl(); + +-- +2.31.1 + diff --git a/perl-Inline-Python.spec b/perl-Inline-Python.spec index ef7899b..2f820d0 100644 --- a/perl-Inline-Python.spec +++ b/perl-Inline-Python.spec @@ -1,11 +1,14 @@ Name: perl-Inline-Python Version: 0.56 -Release: 18%{?dist} +Release: 19%{?dist} Summary: Write Perl subs and classes in Python License: GPL+ or Artistic URL: https://metacpan.org/release/Inline-Python Source0: https://cpan.metacpan.org/authors/id/N/NI/NINE/Inline-Python-%{version}.tar.gz -Patch0: Inline-Python-0.56-Use-python3.patch +# Call Py_Initialize() before calling PyBytes_FromString() +# Fixes segmentation fault with python 3.10 +# https://github.com/niner/inline-python-pm/pull/33 +Patch0: %{name}-pyinit.patch BuildRequires: gcc BuildRequires: findutils BuildRequires: make @@ -59,7 +62,7 @@ name-space is cached, and subsequent calls use the cached version. %patch0 -p1 %build -%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 +INLINE_PYTHON_EXECUTABLE=/usr/bin/python3 %{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 make %{?_smp_mflags} %install @@ -79,6 +82,9 @@ make test %{_mandir}/man3/* %changelog +* Thu Aug 19 2021 Mattias Ellert - 0.56-19 +- Fix segmentation fault with python 3.10 + * Thu Jul 22 2021 Fedora Release Engineering - 0.56-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild