]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
delete exception traceback in _expect_raises
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 3 Jun 2021 03:07:28 +0000 (23:07 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 3 Jun 2021 03:07:28 +0000 (23:07 -0400)
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

index 9ff2f76eb52bed89cde77b5771426293b84a0ae8..b618021a67b8047cabee2992a6eab7043e58a9af 100644 (file)
@@ -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"