Set this thread's context to context.
(context)
| 365 | return context |
| 366 | |
| 367 | def setcontext(context): |
| 368 | """Set this thread's context to context.""" |
| 369 | if context in (DefaultContext, BasicContext, ExtendedContext): |
| 370 | context = context.copy() |
| 371 | context.clear_flags() |
| 372 | _current_context_var.set(context) |
| 373 | |
| 374 | del contextvars # Don't contaminate the namespace |
| 375 |