MrlixiangWE opened a new pull request, #867:
URL: https://github.com/apache/burr/pull/867
Problem
`ApplicationContext.__enter__()` sets the current context, but
`ApplicationContext.__exit__()` clears it to `None`. When one Burr
application
runs inside another application's action, exiting the inner context removes
the
outer current context even though the outer application is still running.
Before / after
Before:
- After `inner_app.run()` returns, `ApplicationContext.get()` in the outer
action returns `None` instead of the outer application's context.
After:
- Each entered scope restores the exact preceding `ContextVar` value when it
exits.
- Nested, reentrant, and concurrent context-manager uses retain task-local
restoration tokens.
Verification
- `.venv/bin/pytest tests/core/test_application.py -k 'context' -q`
(15 passed, 126 deselected)
- `.venv/bin/pytest tests/core --ignore=tests/core/test_graphviz_display.py
-q`
(393 passed; Graphviz display tests were excluded because this local
environment lacks `dot`)
- `.venv/bin/pre-commit run --files burr/core/application.py
tests/core/test_application.py`
(passed)
- `.venv/bin/python -m build` (passed)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]