Index: Lib/fnmatch.py =================================================================== --- Lib/fnmatch.py (revision 83970) +++ Lib/fnmatch.py (working copy) @@ -102,6 +102,19 @@ elif stuff[0] == '^': stuff = '\\' + stuff res = '%s[%s]' % (res, stuff) + elif c == '{': + j = i + if j < n and pat[j] == '}': + j = j+1 + while i < n and pat[j] != '}': + j = j+1 + if j >= n: + res = res + '\\{' + else: + stuff = pat[i:j].replace('\\','\\\\') + i = j+1 + subres = '|'.join(stuff.split(',')) + res = '%s(%s)' % (res, subres) else: res = res + re.escape(c) return res + '\Z(?ms)' Index: Lib/test/test_fnmatch.py =================================================================== --- Lib/test/test_fnmatch.py (revision 83970) +++ Lib/test/test_fnmatch.py (working copy) @@ -30,6 +30,8 @@ check('abc', 'ab[de]', 0) check('a', '??', 0) check('a', 'b', 0) + check('abc', '{a,b}bc', 1) + check('abc', '{b,c}bc', 0) # these test that '\' is handled correctly in character sets; # see SF bug #409651