Fix one more os.path.join issue

This commit is contained in:
Dave Halter
2019-08-08 09:31:13 +02:00
parent 03608151e8
commit 463cbb1595
2 changed files with 9 additions and 2 deletions

View File

@@ -708,14 +708,18 @@ def _os_path_join(args_set, callback):
if len(args_set) == 1:
string = u''
sequence, = args_set
is_first = True
for lazy_context in sequence.py__iter__():
string_contexts = lazy_context.infer()
if len(string_contexts) != 1:
break
s = get_str_or_none(next(iter(string_contexts)))
if string is None:
if s is None:
break
string += os.path.sep + force_unicode(s)
if not is_first:
string += os.path.sep
string += force_unicode(s)
is_first = False
else:
return ContextSet([compiled.create_simple_object(sequence.evaluator, string)])
return callback()

View File

@@ -210,6 +210,9 @@ os_path = 'from os.path import *\n'
(f2, os_path + 'dirname(__file__) + "%stest_ca' % s, None, ['che.py']),
(f2, os_path + 'dirname(abspath(__file__)) + sep + "test_ca', None, ['che.py']),
(f2, os_path + 'join(dirname(__file__), "completion") + sep + "basi', None, ['c.py']),
(f2, os_path + 'join("test", "completion") + sep + "basi', None, ['c.py']),
# inside join
(f2, os_path + 'join(dirname(__file__), "completion", "basi', None, ['c.py"']),
(f2, os_path + 'join(dirname(__file__), "completion", "basi)', 43, ['c.py"']),
(f2, os_path + 'join(dirname(__file__), "completion", "basi")', 43, ['c.py"']),