MCPcopy Index your code
hub / github.com/RustPython/RustPython / __exit__

Method __exit__

Lib/test/libregrtest/save_env.py:343–361  ·  view source on GitHub ↗
(self, exc_type, exc_val, exc_tb)

Source from the content-addressed store, hash-verified

341 return self
342
343 def __exit__(self, exc_type, exc_val, exc_tb):
344 saved_values = self.saved_values
345 self.saved_values = None
346
347 # Some resources use weak references
348 support.gc_collect()
349
350 for name, get, restore, original in saved_values:
351 current = get()
352 # Check for changes to the resource's value
353 if current != original:
354 support.environment_altered = True
355 restore(original)
356 if not self.quiet and not self.pgo:
357 print_warning(
358 f"{name} was modified by {self.test_name}\n"
359 f" Before: {original}\n"
360 f" After: {current} ")
361 return False

Callers

nothing calls this directly

Calls 3

getFunction · 0.85
restoreFunction · 0.85
print_warningFunction · 0.70

Tested by

no test coverage detected