# Buggy code
def _path_from_partial_string(inp, pos=None):
    if pos is None:
        pos = len(inp)
    partial = inp[:pos]
    startix, endix, quote = xt.check_for_partial_string(partial)
    _post = ""
    if startix is None:
        return None
    elif endix is None:
        string = partial[startix:]
    else:
        if endix != pos:
            _test = partial[endix:pos]
            if not any(i == " " for i in _test):
                _post = _test
            else:
                return None
        string = partial[startix:endix]
    end = xt.RE_STRING_START.sub("", quote)
    _string = string
    if not _string.endswith(end):
        _string = _string + end
    try:
        val = ast.literal_eval(_string)
    except SyntaxError:
        return None
    if isinstance(val, bytes):
        env = builtins.__xonsh_env__
        val = val.decode(
            encoding=env.get("XONSH_ENCODING"), errors=env.get("XONSH_ENCODING_ERRORS")
        )
    return string + _post, val + _post, quote, end


# Traceback (ValueError)
 f""Exception in thread Thread-2566:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.7/site-packages/prompt_toolkit/interface.py", line 865, in run
completions = list(buffer.completer.get_completions(document, complete_event))
File "/usr/lib/python3.7/site-packages/xonsh/ptk/completer.py", line 45, in get_completions
prefix, line_ex, begidx + expand_offset, endidx + expand_offset, self.ctx
File "/usr/lib/python3.7/site-packages/xonsh/__amalgam__.py", line 125, in complete
out = func(prefix, line, begidx, endidx, ctx)
File "/usr/lib/python3.7/site-packages/xonsh/completers/__amalgam__.py", line 1274, in complete_path
p = _path_from_partial_string(line, end)
File "/usr/lib/python3.7/site-packages/xonsh/completers/__amalgam__.py", line 1064, in _path_from_partial_string
val = ast.literal_eval(_string)
File "/usr/lib/python3.7/ast.py", line 91, in literal_eval
return _convert(node_or_string)
File "/usr/lib/python3.7/ast.py", line 90, in _convert
return _convert_signed_num(node)
File "/usr/lib/python3.7/ast.py", line 63, in _convert_signed_num
return _convert_num(node)
File "/usr/lib/python3.7/ast.py", line 55, in _convert_num
raise ValueError('malformed node or string: ' + repr(node))
ValueError: malformed node or string: <_ast.JoinedStr object at 0x7f82d1549d68>

# Fixed code
def _path_from_partial_string(inp, pos=None):
    if pos is None:
        pos = len(inp)
    partial = inp[:pos]
    startix, endix, quote = xt.check_for_partial_string(partial)
    _post = ""
    if startix is None:
        return None
    elif endix is None:
        string = partial[startix:]
    else:
        if endix != pos:
            _test = partial[endix:pos]
            if not any(i == " " for i in _test):
                _post = _test
            else:
                return None
        string = partial[startix:endix]
    end = xt.RE_STRING_START.sub("", quote)
    _string = string
    if not _string.endswith(end):
        _string = _string + end
    try:
        val = ast.literal_eval(_string)
    except (SyntaxError, ValueError):
        return None
    if isinstance(val, bytes):
        env = builtins.__xonsh_env__
        val = val.decode(
            encoding=env.get("XONSH_ENCODING"), errors=env.get("XONSH_ENCODING_ERRORS")
        )
    return string + _post, val + _post, quote, end