Repository navigation
Fix MemoryFileSystem.makedirs accepting existing files - #2267
Conversation
|
Validation summary for The normalized store-membership check also preserves the cache suite's no-metadata-lookup assertion. Configured hooks, strict Sphinx, package builds and isolated-wheel checks pass. Optional service/platform skips remain documented. Upstream workflow approval and maintainer review are still pending. |
|
I merged current On the merged head, the memory/cache modules pass 187 tests with 36 skips; the full available suite passes 2,141 tests, 296 skips and 13 xfails. All configured hooks pass on the three changed files. No force push or unrelated source adjustment was made. |
| self.mkdir(path, create_parents=True) | ||
| except FileExistsError: | ||
| if not exist_ok: | ||
| if not exist_ok or self._strip_protocol(path) in self.store: |
There was a problem hiding this comment.
Same as self.isfile ? Might be clearer.
There was a problem hiding this comment.
Agreed; MemoryFileSystem.isfile() already normalizes the path and checks self.store directly, so it expresses the intent without adding a metadata lookup. I changed the condition to self.isfile(path) in e17798b. The focused memory/cache modules pass (204 passed, 36 skipped), the full available suite passes (2,194 passed, 298 skipped, 13 xfailed), and the configured hooks pass. Thanks for the clearer spelling.
|
The base advanced again after my previous update, so I merged On the new |
|
Merged current master ( Validation on the merged source: memory/cache modules 204 passed / 36 skipped; full available suite 2,200 passed / 303 skipped / 13 xfailed; all configured hooks pass. The PR description now reflects this head and these results. |
Fixes #2266.
Summary
MemoryFileSystem.makedirs(..., exist_ok=True)returned success when the target was an existing file. The target still was not a directory, contrary to the base-method contract and local filesystem behavior. Re-raiseFileExistsErrorwhen the normalized target is in the memory file store; existing directories remain accepted. This preserves the cache suite's no-metadata-lookup behavior.The 12 regression cases cover relative, absolute and
memory://paths, bothexist_okvalues, and themakedirs/mkdirsentry points. Each checks that existing file contents remain intact. A Dev changelog entry describes the fix.Verification
masterat46c05cbwithout a force push. The PR diff remains three files, 16 additions and one deletion.self.isfile(path), whose implementation normalizes the path and directly checks the in-memory store. The focused memory/cache modules pass 204 tests, 36 skips; the full suite remains 2,200 passed, 303 skipped, 13 xfailed on the reviewed head. Configured hooks pass. Earlier strict Sphinx, source/wheel build and isolated-wheel collision checks passed before the base sync.AI assistance was used to investigate and prepare the patch. I reviewed the merge resolution and reran the suite and hooks.