Antoine Pitrou <pit...@free.fr> added the comment: Thanks for the patch.
+ if j < n and pat[j] == '}': + j = j+1 I don't get what the purpose of these two lines is. Forbid empty patterns? + while i < n and pat[j] != '}': + j = j+1 You probably mean "while j < n" instead of "while i < n". Regardless, it's simpler to use "j = pat.find('}', j)". You should also add a test for unmatched braces. Currently: $ ./python -c "import fnmatch; print(fnmatch.translate('{x'))" Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/antoine/py3k/__svn__/Lib/fnmatch.py", line 129, in translate while i < n and pat[j] != '}': IndexError: string index out of range ---------- nosy: +pitrou _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9584> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com