Skip to content

Commit d2ffff0

Browse files
committed
docs: Changelog entry for contextvar change
1 parent 02d2609 commit d2ffff0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,20 @@ Release 0.14 (in development)
3939
.. rubric:: Deprecated APIs or behavior
4040

4141
* ``Route.get_undecorated_callback()`` was able to look into closure cells to guess the original function wrapped by a decorator, but this is too aggressive in some cases and may return the wrong function. To avoid this, we will depend on proper use of ``@functools.wraps(orig)`` or ``functools.update_wrapper(wrapper, orig)`` in decorators in the future.
42+
* ``bottle.local`` is deprecated. Use :class:`contextvars.ContextVar` or assign custom attributes to ``bottle.request`` if your application depends on thread-local or request-local but globally accessible state.
4243

4344
.. rubric:: Removed APIs
4445

4546
* Dropped support for Python 2 (EOL: 2020-01-01) and removed workarounds or helpers that only make sense in a Python 2/3 dual codebase.
4647
* Dropped support for Python 3.8 (EOL: 2024-10-07).
4748
* Removed the ``RouteReset`` exception and associated logic.
4849
* Removed the `bottle.py` console script entrypoint in favour of the new `bottle` script. You can still execute `bottle.py` directly or via `python -m bottle`. The only change is that the command installed by pip or similar tools into the bin/Scripts folder of the (virtual) environment is now called `bottle` to avoid circular import errors.
50+
* The bottle CLI no longer monkey-patches python standard libraries when selecting the `gevent` or `eventlet` server adapter. This was an incomplete workaround anyway and is no longer required by bottle itself, but if your own application depends on it, you may need to add ``gevent.monkey.patch_all()`` to your own wsgi application script.
4951

5052
.. rubric:: Changes
5153

5254
* Form values, query parameters, path elements and cookies are now always decoded as `utf8` with `errors='surrogateescape'`. This is the correct approach for almost all modern web applications, but still allows applications to recover the original byte sequence if needed. This also means that ``bottle.FormsDict`` no longer re-encodes PEP-3333 `latin1` strings to `utf8` on demand (via attribute access). The ``FormsDict.getunicode()`` and ``FormsDict.decode()`` methods are deprecated and do nothing, as all values are already transcoded to `utf8`.
55+
* Bottle now use :class:`contextvars.ContextVar` instead of :class:`threading.local` wherever possible. Contexts are natively supported by gevent and bottle no longer depends on monkey-patching in greenlet-based server environments. Running gunicorn with the gevent worker now *just works* without additional steps.
5356

5457
.. rubric:: New features
5558

0 commit comments

Comments
 (0)