MCPcopy Index your code
hub / github.com/python/cpython / setcontext

Function setcontext

Lib/_pydecimal.py:370–375  ·  view source on GitHub ↗

Set this thread's context to context.

(context)

Source from the content-addressed store, hash-verified

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

Callers 7

__enter__Method · 0.85
__exit__Method · 0.85
test_default_contextMethod · 0.85
test_c_context_errorsMethod · 0.85

Calls 3

clear_flagsMethod · 0.80
copyMethod · 0.45
setMethod · 0.45

Tested by 5

test_default_contextMethod · 0.68
test_c_context_errorsMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…