You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a simple module-level cache (_registered_context_vars) to store
and reuse ContextVar instances by name. This prevents the memory leak
in _configure_hooks while maintaining the original API.
Changes:
- Add _registered_context_vars cache dict at module level
- Reuse existing ContextVar instances instead of creating new ones
- Only register hooks once per unique name
- Update test to verify cache behavior instead of internal hooks
- Maintain full backward compatibility
0 commit comments