diff -r 08829230079b Lib/macpath.py --- a/Lib/macpath.py Sat May 16 10:10:21 2015 -0400 +++ b/Lib/macpath.py Sat May 16 19:55:37 2015 +0300 @@ -53,6 +53,8 @@ def join(s, *p): try: colon = _get_colon(s) path = s + if not p: + path[:0] + colon #23780: Ensure compatible data type even if p is null. for t in p: if (not path) or isabs(t): path = t diff -r 08829230079b Lib/ntpath.py --- a/Lib/ntpath.py Sat May 16 10:10:21 2015 -0400 +++ b/Lib/ntpath.py Sat May 16 19:55:37 2015 +0300 @@ -81,6 +81,8 @@ def join(path, *paths): seps = '\\/' colon = ':' try: + if not paths: + path[:0] + sep #23780: Ensure compatible data type even if p is null. result_drive, result_path = splitdrive(path) for p in paths: p_drive, p_path = splitdrive(p) diff -r 08829230079b Lib/posixpath.py --- a/Lib/posixpath.py Sat May 16 10:10:21 2015 -0400 +++ b/Lib/posixpath.py Sat May 16 19:55:37 2015 +0300 @@ -76,6 +76,8 @@ def join(a, *p): sep = _get_sep(a) path = a try: + if not p: + path[:0] + sep #23780: Ensure compatible data type even if p is null. for b in p: if b.startswith(sep): path = b diff -r 08829230079b Lib/test/test_genericpath.py --- a/Lib/test/test_genericpath.py Sat May 16 10:10:21 2015 -0400 +++ b/Lib/test/test_genericpath.py Sat May 16 19:55:37 2015 +0300 @@ -448,6 +448,10 @@ class CommonTest(GenericTest): self.pathmodule.join(42, 'str') with self.assertRaisesRegex(TypeError, errmsg % 'int'): self.pathmodule.join('str', 42) + with self.assertRaisesRegex(TypeError, errmsg % 'int'): + self.pathmodule.join(42) + with self.assertRaisesRegex(TypeError, errmsg % 'list'): + self.pathmodule.join([]) with self.assertRaisesRegex(TypeError, errmsg % 'bytearray'): self.pathmodule.join(bytearray(b'foo'), bytearray(b'bar'))