bottle icon indicating copy to clipboard operation
bottle copied to clipboard

Migrate from threading.local to contextvars

Open defnull opened this issue 6 months ago • 0 comments

LocalRequest and LocalResponse now use ContextVar instead of threading.local() to implement thread-local state. This is natively supported by greenlet and monkey-patching the threading library is no longer needeed to support greenlet-based servers (e.g. gunicorn with gevent worker).

The Cheetah template adapter was changed to no longer depend on any form of thread-local state.

The module-global local variable is still an instance of threading.local, but not used by bottle and now deprecated.

defnull avatar Jun 28 '25 07:06 defnull