MCPcopy Create free account
hub / github.com/numpy/numpy / _no_tracing

Function _no_tracing

numpy/testing/_private/utils.py:2478–2495  ·  view source on GitHub ↗

Decorator to temporarily turn off tracing for the duration of a test. Needed in tests that check refcounting, otherwise the tracing itself influences the refcounts

(func)

Source from the content-addressed store, hash-verified

2476
2477
2478def _no_tracing(func):
2479 """
2480 Decorator to temporarily turn off tracing for the duration of a test.
2481 Needed in tests that check refcounting, otherwise the tracing itself
2482 influences the refcounts
2483 """
2484 if not hasattr(sys, 'gettrace'):
2485 return func
2486 else:
2487 @wraps(func)
2488 def wrapper(*args, **kwargs):
2489 original_trace = sys.gettrace()
2490 try:
2491 sys.settrace(None)
2492 return func(*args, **kwargs)
2493 finally:
2494 sys.settrace(original_trace)
2495 return wrapper
2496
2497
2498def _get_glibc_version():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected