issue27186: add C version of os.fspath(); patch by Jelle Zijlstra

This commit is contained in:
Ethan Furman 2016-06-04 12:06:26 -07:00
parent c55014f371
commit 410ef8e230
6 changed files with 125 additions and 18 deletions

View file

@ -3121,6 +3121,13 @@ class TestPEP519(unittest.TestCase):
self.assertEqual(b"path/like/object", os.fsencode(pathlike))
self.assertEqual("path/like/object", os.fsdecode(pathlike))
def test_fspathlike(self):
class PathLike(object):
def __fspath__(self):
return '#feelthegil'
self.assertEqual('#feelthegil', os.fspath(PathLike()))
def test_garbage_in_exception_out(self):
vapor = type('blah', (), {})
for o in int, type, os, vapor():