Use os.fspath on Path (#15530)
### Description
<!-- Describe your changes. -->
Use os.fspath instead of str() on a path object.
### Motivation and Context
I learned today that os.fspath is the right way to go:
https://github.com/charliermarsh/ruff/issues/3675#issuecomment-1494975508