From 6de1186f34c0eb1c506c71dce45e6d814b6d57e5 Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Aug 31 2020 16:26:59 +0000 Subject: Add new upstream patch --- diff --git a/665c532745987fb1c7a8fc2a9a57bffa330480b4.patch b/665c532745987fb1c7a8fc2a9a57bffa330480b4.patch new file mode 100644 index 0000000..660b90f --- /dev/null +++ b/665c532745987fb1c7a8fc2a9a57bffa330480b4.patch @@ -0,0 +1,36 @@ +From 665c532745987fb1c7a8fc2a9a57bffa330480b4 Mon Sep 17 00:00:00 2001 +From: Dilawar +Date: Sat, 29 Aug 2020 06:44:37 +0000 +Subject: [PATCH] A better fix to #419 + +dict `locals_` is not Py_XINCREF anywhere that is why Py_XDECREF caused segfault. +While `globals_` does not have this issue. In the previous fix https://github.com/BhallaLab/moose-core/pull/420/commits/c570f7c057f9c0ca7360c82a8932bcb0df222da9, +I removed the `Py_XINCREF(globals_)` line as well which would cause memory leak. +--- + pymoose/PyRun.cpp | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/pymoose/PyRun.cpp b/pymoose/PyRun.cpp +index 765226c453..d7d6a7974a 100644 +--- a/pymoose/PyRun.cpp ++++ b/pymoose/PyRun.cpp +@@ -188,6 +188,7 @@ PyRun::PyRun():mode_(0), initstr_(""), runstr_(""), + cerr << "Could not initialize locals dict" << endl; + return; + } ++ + PyObject * value = PyFloat_FromDouble(0.0); + if (!value && PyErr_Occurred()){ + PyErr_Print(); +@@ -200,11 +201,7 @@ PyRun::PyRun():mode_(0), initstr_(""), runstr_(""), + + PyRun::~PyRun() + { +-#if 0 +- // Fixes to BhallaLab/moose-core#420 + Py_XDECREF(globals_); +- Py_XDECREF(locals_); +-#endif + } + + void PyRun::setRunString(string statement) diff --git a/moose.spec b/moose.spec index 346eed0..2995c25 100644 --- a/moose.spec +++ b/moose.spec @@ -4,7 +4,7 @@ Name: moose Version: 3.1.5 %global codename chamcham -Release: 2%{?dist}%{?prerelease:.%{prerelease}}%{?commit:.git%{shortcommit}} +Release: 3%{?dist}%{?prerelease:.%{prerelease}}%{?commit:.git%{shortcommit}} Summary: Multiscale Neuroscience and Systems Biology Simulator License: GPLv3 URL: http://moose.ncbs.res.in/ @@ -17,8 +17,9 @@ Source0: https://github.com/BhallaLab/moose-core/archive/v%{version}.tar. # Fix segfault on py3.9 # https://github.com/BhallaLab/moose-core/pull/420 Patch0: c570f7c057f9c0ca7360c82a8932bcb0df222da9.patch +Patch1: 665c532745987fb1c7a8fc2a9a57bffa330480b4.patch # ppc defines a different suffix which breaks the build -Patch1: 0001-Use-.so-suffix-for-all-arches.patch +Patch2: 0001-Use-.so-suffix-for-all-arches.patch ExcludeArch: s390x @@ -143,6 +144,9 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -c \ %doc README.md %changelog +* Sat Aug 29 2020 Ankur Sinha - 3.1.5-3 +- Update patch + * Thu Aug 27 2020 Ankur Sinha - 3.1.5-2 - Add patch to fix ppc build - Disable lto on arm