Use `os.replace` instead of `shutil.move` in `SessionStore`?

shutil.move depends on os.rename semantics in case the destination file exists as per the official documentation. This is not atomic as explained in this issue. As a resolution to the before-mentioned issue, os.replace was introduced which is atomic in a cross-platform manner as per my understanding. So should that be used instead of shutil.move?

This seems reasonable, but it won’t be a drop-in replacement. shutil.move is recursive and can traverse filesystems. It really seems like we’d want shutil.move to use os.replace internally when possible…

The SessionStore.save does not seem to be renaming (or moving) a directory though so that should not be an issue right. It’s aiming to rename it, and the goal isn’t actually to move the file so I think shutil.move can be replaced with os.replace.

Am I missing something or is there some impact on another area that I am not aware of?

Sorry I didn’t look at the session store core. Sounds reasonable to me. Please file a ticket and open a PR when you can.