Backport patch to fix Segmentation Faults caused by greenlet and Python 3.10b2

This commit is contained in:
Tomas Hrnciar 2021-06-03 15:25:28 +02:00 committed by Miro Hrončok
parent 55621d11e2
commit 340fc49873
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From dcdc9442ed94f0857a62de40e17e588250f0576e Mon Sep 17 00:00:00 2001
From: Mike Bayer <mike_mp@zzzcomputing.com>
Date: Wed, 2 Jun 2021 23:07:28 -0400
Subject: [PATCH] delete exception traceback in _expect_raises
a new segfault is observed in python 3.10.0b2 in conjunction
with asyncio and possibly greenlet. Ensuring the
traceback object is deleted from scope here, which is a
good idea anyway, apparently seems to resolve the issue.
Change-Id: Ia83bafb088ef19853044f1d436db259cbfd1e5f4
References: https://github.com/python-greenlet/greenlet/issues/242
---
lib/sqlalchemy/testing/assertions.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/sqlalchemy/testing/assertions.py b/lib/sqlalchemy/testing/assertions.py
index 9ff2f76eb5..b618021a67 100644
--- a/lib/sqlalchemy/testing/assertions.py
+++ b/lib/sqlalchemy/testing/assertions.py
@@ -372,6 +372,13 @@ def _expect_raises(except_cls, msg=None, check_context=False):
_assert_proper_exception_context(err)
print(util.text_type(err).encode("utf-8"))
+ # it's generally a good idea to not carry traceback objects outside
+ # of the except: block, but in this case especially we seem to have
+ # hit some bug in either python 3.10.0b2 or greenlet or both which
+ # this seems to fix:
+ # https://github.com/python-greenlet/greenlet/issues/242
+ del ec
+
# assert outside the block so it works for AssertionError too !
assert success, "Callable did not raise an exception"

View File

@ -35,6 +35,10 @@ Source0: https://files.pythonhosted.org/packages/source/S/%{srcname}/%{sr
# Downstream report: https://bugzilla.redhat.com/show_bug.cgi?id=1959305
Patch1: 0001-filter-out-DeprecationWarnings.patch
# SQLAlchemy segfault with Python 3.10 due to error in greenlet
# Upstream report: https://github.com/python-greenlet/greenlet/issues/242
Patch2: https://github.com/sqlalchemy/sqlalchemy/commit/dcdc9442ed94f0857a62de40e17e588250f0576e.patch
BuildRequires: gcc
BuildRequires: python3-devel >= 3.6
BuildRequires: python3-greenlet >= 1.0
@ -86,6 +90,7 @@ This package includes the python 3 version of the module.
%prep
%setup -q -n %{srcname}-%{srcversion}
%patch1 -p1
%patch2 -p1
# Remove flag for pytest-xdist. (python2-pytest-xdist is a removed dependency.)
# (--max-worker-restart=5 would end the test run after 5 crashing tests.)