[Python-checkins] r43739 - in python/trunk: Lib/glob.py Lib/test/test_glob.py Misc/NEWS
neal.norwitz
python-checkins at python.org
Sun Apr 9 05:35:44 CEST 2006
Author: neal.norwitz
Date: Sun Apr 9 05:35:43 2006
New Revision: 43739
Modified:
python/trunk/Lib/glob.py
python/trunk/Lib/test/test_glob.py
python/trunk/Misc/NEWS
Log:
glob('anything*/') would fail because isdir is in os.path, not os.
Modified: python/trunk/Lib/glob.py
==============================================================================
--- python/trunk/Lib/glob.py (original)
+++ python/trunk/Lib/glob.py Sun Apr 9 05:35:43 2006
@@ -60,7 +60,7 @@
if basename == '':
# `os.path.split()` returns an empty basename for paths ending with a
# directory separator. 'q*x/' should match only directories.
- if os.isdir(dirname):
+ if os.path.isdir(dirname):
return [basename]
else:
if os.path.lexists(os.path.join(dirname, basename)):
Modified: python/trunk/Lib/test/test_glob.py
==============================================================================
--- python/trunk/Lib/test/test_glob.py (original)
+++ python/trunk/Lib/test/test_glob.py Sun Apr 9 05:35:43 2006
@@ -80,6 +80,14 @@
eq(self.glob('?a?', '*F'), map(self.norm, [os.path.join('aaa', 'zzzF'),
os.path.join('aab', 'F')]))
+ def test_glob_directory_with_trailing_slash(self):
+ # We are verifying that when there is wildcard pattern which
+ # ends with os.sep doesn't blow up.
+ res = glob.glob(self.tempdir + '*' + os.sep)
+ self.assertEqual(len(res), 1)
+ # either of these results are reasonable
+ self.assertTrue(res[0] in [self.tempdir, self.tempdir + os.sep])
+
def test_glob_broken_symlinks(self):
if hasattr(os, 'symlink'):
eq = self.assertSequencesEqual_noorder
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Apr 9 05:35:43 2006
@@ -20,6 +20,8 @@
Library
-------
+- Fix exception when doing glob.glob('anything*/')
+
Build
-----
More information about the Python-checkins
mailing list