Author pitrou
Recipients bochecha, pitrou
Date 2010-08-13.10:23:11
SpamBayes Score 1.48523e-09
Marked as misclassified No
Message-id <1281694994.12.0.755084274062.issue9584@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2010-08-13 10:23:14pitrousetrecipients: + pitrou, bochecha
2010-08-13 10:23:14pitrousetmessageid: <1281694994.12.0.755084274062.issue9584@psf.upfronthosting.co.za>
2010-08-13 10:23:12pitroulinkissue9584 messages
2010-08-13 10:23:11pitroucreate