Problem
AioS3FileSystem._rm() ignores maxdepth.
It expands each path with self._sync_fs.expand_path(p, recursive=recursive) (pyathena/filesystem/s3_async.py:191 on master e0e85da) and never passes maxdepth, which stays unused in **kwargs.
_rm(path, recursive=True, maxdepth=1) (and the generated sync AioS3FileSystem.rm() wrapper) therefore deletes every object under the path instead of only the first level.
S3FileSystem.rm() passes maxdepth to expand_path(); the async implementation does not.
Found by code reading during the review of #956 (#933).
Reproduction
fs = AioS3FileSystem(...)
await fs._pipe_file("s3://BUCKET/tmp/d/a", b"")
await fs._pipe_file("s3://BUCKET/tmp/d/sub/b", b"")
await fs._rm("s3://BUCKET/tmp/d", recursive=True, maxdepth=1)
# expected: tmp/d/sub/b remains
# actual: tmp/d/sub/b is deleted
Environment
- PyAthena master e0e85da, fsspec 2026.9.0.
Proposed fix (optional)
Accept maxdepth in _rm() and pass it to expand_path(), as S3FileSystem.rm() does, with a test that deletes with maxdepth and checks that deeper objects remain.
Problem
AioS3FileSystem._rm()ignoresmaxdepth.It expands each path with
self._sync_fs.expand_path(p, recursive=recursive)(pyathena/filesystem/s3_async.py:191on master e0e85da) and never passesmaxdepth, which stays unused in**kwargs._rm(path, recursive=True, maxdepth=1)(and the generated syncAioS3FileSystem.rm()wrapper) therefore deletes every object under the path instead of only the first level.S3FileSystem.rm()passesmaxdepthtoexpand_path(); the async implementation does not.Found by code reading during the review of #956 (#933).
Reproduction
Environment
Proposed fix (optional)
Accept
maxdepthin_rm()and pass it toexpand_path(), asS3FileSystem.rm()does, with a test that deletes withmaxdepthand checks that deeper objects remain.