This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author contrebasse
Recipients contrebasse
Date 2018-05-25.10:00:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527242401.32.0.682650639539.issue33646@psf.upfronthosting.co.za>
In-reply-to
Content
os.fspath() returns its argument if it is a str. That means that it bypasses __fspath__ for str subclasses.

This is the case for the library path.py for example.

This is a corner case that was discovered while trying to fix https://github.com/matplotlib/matplotlib/issues/11306

Minimal example:

```
import os

class MyPath(str):
    def __fspath__(self):
        print("Returns a pure string")
        return str(self)

os.fspath(MyPath())  # Prints nothing
```
History
Date User Action Args
2018-05-25 10:00:01contrebassesetrecipients: + contrebasse
2018-05-25 10:00:01contrebassesetmessageid: <1527242401.32.0.682650639539.issue33646@psf.upfronthosting.co.za>
2018-05-25 10:00:01contrebasselinkissue33646 messages
2018-05-25 10:00:01contrebassecreate