Fix backward incompatibility introduced in 2.4.16 (#535)#542
Fix backward incompatibility introduced in 2.4.16 (#535)#542althonos merged 9 commits intoPyFilesystem:masterfrom
Conversation
|
I found another case where the optimized and the regular code path behave differently: with open_fs(fs_url) as tmp:
tmp.writetext("file.txt", "content")
fs.move.move_file(tmp, "file.txt", tmp, "file.txt")If you move a file onto itself, the optimized code path works as expected, but the regular code path happens to delete the file. This is not wanted, I guess? I added some code to fix this. EDIT: |
|
Eeek! If attempting to move a file onto itself, I guess it makes sense to just early-exit? 🤔 |
|
What stops this PR from being resolved? |
|
I still think you ought to do |
|
Yep, some things left to do on my side. Didn't have the time yet. |
@tfeldmann Can you create an issue for https://github.com/PyFilesystem/pyfilesystem2/blob/master/fs/base.py#L1138 please? |
On it! |
|
HOORAY! Good job everybody let's bump a version for this library already! |
|
Great job @tfeldmann ! |
* add default overwrite arg (fixes PyFilesystem#535) * update changelog * add tests * fix deletion when moving file on itself * compare normalized pathes in early exit * check no longer needed * remove unused import
## [2.4.17](v2.4.16...v2.4.17) (2025-09-28) ### Bug Fixes * add failing tests ([ba8b583](ba8b583)) * Added filter_glob and exclude_glob to fs.walk.Walker. ([7d91dc8](7d91dc8)) * assert DestinationExists when using overwrite=False ([5efca65](5efca65)) * assert no files were touched ([6d9e696](6d9e696)) * backward incompatibility introduced in 2.4.16 ([PyFilesystem#542](https://github.com/abichinger/pyfilesystem2/issues/542)) ([f84055e](f84055e)), closes [PyFilesystem#535](https://github.com/abichinger/pyfilesystem2/issues/535) * Changes from code review. ([fa8f924](fa8f924)) * copy_structure FS can be of type str ([1d0b87e](1d0b87e)) * copydir hangup ([52c5597](52c5597)) * drop the final remaining use of the deprecated pkg_resources module ([7e8e923](7e8e923)) * establish new errors.IllegalDestination ([a751c9b](a751c9b)) * memoryfs ([0bb7597](0bb7597)) * migrate entrypoints handling to standard library importlib.metadata ([61c198e](61c198e)) * new error names ([988ca09](988ca09)) * osfs ([7df6d97](7df6d97)) * OSFS copy ([799239e](799239e)) * raise DestinationExists if overwrite is not set ([39d0534](39d0534)) * Set `timeout-minutes` in the `test.yml` Actions workflow ([PyFilesystem#548](https://github.com/abichinger/pyfilesystem2/issues/548)) ([ae69d3e](ae69d3e)) * typo in `docs/source/info.rst` ([PyFilesystem#544](https://github.com/abichinger/pyfilesystem2/issues/544)) ([c3cfb76](c3cfb76)) * use validatepath ([9160080](9160080)) * uses validated paths in copydir ([d09b2cc](d09b2cc)) * wip copy ([09763c8](09763c8)) * wrapfs ([f0bf836](f0bf836)) * wrapfs does not need checks sprinkled everywhere anymore ([6b64e92](6b64e92))
Type of changes
Checklist
Description
Added
overwrite=Trueto the optimized path infs.move.move_file.move_filenow behaves like in versions <2.4.16.