Merged revisions 74475 via svnmerge from · python/cpython@0109970 · GitHub
Skip to content

Commit 0109970

Browse files
committed
Merged revisions 74475 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74475 | gregory.p.smith | 2009-08-16 11:52:58 -0700 (Sun, 16 Aug 2009) | 2 lines Issue 6665: Fix fnmatch to properly match filenames with newlines in them. ........
1 parent c3b2ae4 commit 0109970

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

Lib/fnmatch.py

Lines changed: 1 addition & 1 deletion

Lib/test/test_fnmatch.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ def test_fnmatch(self):
3232
check('a', 'b', 0)
3333

3434
# these test that '\' is handled correctly in character sets;
35-
# see SF bug #???
35+
# see SF bug #409651
3636
check('\\', r'[\]')
3737
check('a', r'[!\]')
3838
check('\\', r'[!\]', 0)
3939

40+
# test that filenames with newlines in them are handled correctly.
41+
# http://bugs.python.org/issue6665
42+
check('foo\nbar', 'foo*')
43+
check('foo\nbar\n', 'foo*')
44+
check('\nfoo', 'foo*', False)
45+
check('\n', '*')
46+
4047
def test_mix_bytes_str(self):
4148
self.assertRaises(TypeError, fnmatch, 'test', b'*')
4249
self.assertRaises(TypeError, fnmatch, b'test', '*')
@@ -46,6 +53,8 @@ def test_mix_bytes_str(self):
4653
def test_bytes(self):
4754
self.check_match(b'test', b'te*')
4855
self.check_match(b'test\xff', b'te*\xff')
56+
self.check_match(b'foo\nbar', b'foo*')
57+
4958

5059
def test_main():
5160
support.run_unittest(FnmatchTestCase)

Misc/NEWS

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)