]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Support PEP-567 context variables
authorFantix King <fantix.king@gmail.com>
Thu, 19 Nov 2020 16:53:50 +0000 (11:53 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Nov 2020 19:20:59 +0000 (14:20 -0500)
commit9c7fb63dba0d918e0a6dcba08392759f5b159ee4
tree8ce8500ce8bdc79cb3d88e7f40b217ea68ca8b19
parent57ca85de0e81222a1e1b875cdc1df10a1220a330
Support PEP-567 context variables

Invoke the given function within a copy of the current PEP-567
context in `greenlet_spawn()`, so that subsequent sync methods could
retrieve the correct context variable.

Adjusted the greenlet integration, which provides support for Python asyncio
in SQLAlchemy, to accommodate for the handling of Python ``contextvars``
(introduced in Python 3.7) for ``greenlet`` versions greater than 0.4.17.
Greenlet version 0.4.17 added automatic handling of contextvars in a
backwards-incompatible way; we've coordinated with the greenlet authors to
add a preferred API for this in versions subsequent to 0.4.17 which is now
supported by SQLAlchemy's greenlet integration.  For greenlet versions prior
to 0.4.17 no behavioral change is needed, version 0.4.17 itself is blocked
from the dependencies.

Fixes: #5615
Closes: #5616
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5616
Pull-request-sha: dcf42f7b78ef3e983fda17f7190cda7b4511e3b4

Change-Id: I378953ee69e1ef2535ba51b97f28cbbbf9de3161
doc/build/changelog/unreleased_14/5615.rst [new file with mode: 0644]
lib/sqlalchemy/util/_concurrency_py3k.py
setup.cfg
test/base/test_concurrency_py3k.py
tox.ini