Skip to content

Commit 4596d0c

Browse files
authored
fix: Remove unused file handle (#1437)
Remove unused file handle FSSpecSource uses an entirely stateless interface for the actual reading, so this file handle is now an unused remnant.
1 parent 237c80d commit 4596d0c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/uproot/source/fsspec.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def __init__(
4040
# What should we do when there is a chain of filesystems?
4141
self._async_impl = self._fs.async_impl
4242

43-
self._file = None
44-
4543
self._open()
4644

4745
self.__enter__()
@@ -56,7 +54,6 @@ def extract_fsspec_options(cls, options: dict) -> dict:
5654

5755
def _open(self):
5856
self._executor = FSSpecLoopExecutor()
59-
self._file = self._fs.open(self._file_path)
6057

6158
def __repr__(self):
6259
path = repr(self._file_path)
@@ -67,19 +64,16 @@ def __repr__(self):
6764
def __getstate__(self):
6865
state = dict(self.__dict__)
6966
state.pop("_executor")
70-
state.pop("_file")
7167
return state
7268

7369
def __setstate__(self, state):
7470
self.__dict__ = state
75-
self._file = None
7671
self._open()
7772

7873
def __enter__(self):
7974
return self
8075

8176
def __exit__(self, exception_type, exception_value, traceback):
82-
self._file.__exit__(exception_type, exception_value, traceback)
8377
self._executor.shutdown()
8478

8579
def chunk(self, start: int, stop: int) -> uproot.source.chunk.Chunk:
@@ -190,7 +184,8 @@ def closed(self) -> bool:
190184
True if the associated file/connection/thread pool is closed; False
191185
otherwise.
192186
"""
193-
return self._file.closed
187+
# FSSpecSource uses entirely stateless interfaces
188+
return False
194189

195190

196191
class FSSpecLoopExecutor(uproot.source.futures.Executor):

0 commit comments

Comments
 (0)