Commit c925f26
committed
Fix unclosed file warnings in json.load() calls
The json.load(open(...)) pattern leaves file handles open, causing
ResourceWarning when Python is run with warnings enabled. This is
particularly noisy when using multiprocessing, as each worker triggers
the warning when importing the module.
Changes:
- neuropixels_tools.py: Use context manager in _load_np_probe_features()
- testing.py: Use context manager when loading JSON schema
Both files now properly close file handles using 'with' statements.
Fixes issue reported for Python 3.14 on Linux with forkserver multiprocessing.1 parent bbeb144 commit c925f26
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments