diff -r 56cc9de5c024 Lib/idlelib/AutoComplete.py --- a/Lib/idlelib/AutoComplete.py Thu May 31 22:41:51 2012 +0200 +++ b/Lib/idlelib/AutoComplete.py Sat Jun 02 12:48:40 2012 -0700 @@ -12,6 +12,13 @@ # This string includes all chars that may be in a file name (without a path # separator) FILENAME_CHARS = string.ascii_letters + string.digits + os.curdir + "._~#$:-" +# This string includes all chars not allowed in a filename +if os.name == 'posix': + INVALID_CHARS = '\0/' +elif os.name == 'mac': + INVALID_CHARS = '\0:' +else: + INVALID_CHARS = '\0\\/:*?"<>|' # This string includes all chars that may be in an identifier ID_CHARS = string.ascii_letters + string.digits + "_" @@ -126,11 +133,11 @@ if hp.is_in_string() and (not mode or mode==COMPLETE_FILES): self._remove_autocomplete_window() mode = COMPLETE_FILES - while i and curline[i-1] in FILENAME_CHARS: + while i and curline[i-1] not in INVALID_CHARS: i -= 1 comp_start = curline[i:j] j = i - while i and curline[i-1] in FILENAME_CHARS + SEPS: + while i and curline[i-1] not in INVALID_CHARS.relpace(SEPS, ''): i -= 1 comp_what = curline[i:j] elif hp.is_in_code() and (not mode or mode==COMPLETE_ATTRIBUTES):