MCPcopy Index your code
hub / github.com/numpy/numpy / test_load_refcount

Function test_load_refcount

numpy/lib/tests/test_io.py:2688–2703  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2686@pytest.mark.thread_unsafe(reason="garbage collector is global state")
2687@pytest.mark.slow
2688def test_load_refcount():
2689 # Check that objects returned by np.load are directly freed based on
2690 # their refcount, rather than needing the gc to collect them.
2691
2692 f = BytesIO()
2693 np.savez(f, [1, 2, 3])
2694 f.seek(0)
2695
2696 with assert_no_gc_cycles():
2697 np.load(f)
2698
2699 f.seek(0)
2700 dt = [("a", 'u1', 2), ("b", 'u1', 2)]
2701 with assert_no_gc_cycles():
2702 x = np.loadtxt(TextIO("0 1 2 3"), dtype=dt)
2703 assert_equal(x, np.array([((0, 1), (2, 3))], dtype=dt))
2704
2705
2706def test_load_multiple_arrays_until_eof():

Callers

nothing calls this directly

Calls 4

assert_no_gc_cyclesFunction · 0.90
assert_equalFunction · 0.90
TextIOClass · 0.85
seekMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…