[issue15275] isinstance is called a more times that needed in ntpath

STINNER Victor report at bugs.python.org
Tue Jul 22 12:12:08 CEST 2014


STINNER Victor added the comment:

I like ntpath_cleanup.diff, I don't think that it makes the code worse.

FYI os.fsencode() accepts str too, you can simplify:

     if isinstance(path, bytes):
-        userhome = userhome.encode(sys.getfilesystemencoding())
+        userhome = os.fsencode(userhome)

to


+    userhome = os.fsencode(userhome)

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15275>
_______________________________________


More information about the Python-bugs-list mailing list