`stream_with_context` does not propagate `g`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 206
- PR merge metrics
- No merged PRs in 30d
Description
When I use the stream_with_context decorator on a streaming generator, attributes set on the g object earlier in the request aren't visible in the generator. Someone else has described this already on stackoverflow and given an example.
This is easily worked around by passing the needed attributes into the generator and restoring them when it starts, but it's a surprising behavior that should be either changed or documented.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the stream_with_context decorator and reproduce the behavior using the linked Stack Overflow example, checking how request context and g are handled by the streaming generator. Resolve whether the expected outcome is propagation or documentation, then verify the chosen behavior with regression coverage or updated documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100