diff options
author | Georg Brandl <georg@python.org> | 2007-03-10 08:06:14 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-10 08:06:14 (GMT) |
commit | 237458b2bff259d847670f6eb2e3ac48721a1634 (patch) | |
tree | a180f302f5f08c758bc26a8e23fbf6228f399c4f /Lib | |
parent | 86d8d3520d674bf66000e2930adf6df53f3fb0fa (diff) | |
download | cpython-237458b2bff259d847670f6eb2e3ac48721a1634.zip cpython-237458b2bff259d847670f6eb2e3ac48721a1634.tar.gz cpython-237458b2bff259d847670f6eb2e3ac48721a1634.tar.bz2 |
Revert rev. 54198, it's not really backwards compatible.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/glob.py | 11 | ||||
-rw-r--r-- | Lib/test/test_glob.py | 10 |
2 files changed, 4 insertions, 17 deletions
diff --git a/Lib/glob.py b/Lib/glob.py index a92b11f..95656cc 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -1,9 +1,8 @@ """Filename globbing utility.""" -import sys import os -import re import fnmatch +import re __all__ = ["glob", "iglob"] @@ -49,15 +48,13 @@ def iglob(pathname): def glob1(dirname, pattern): if not dirname: dirname = os.curdir - if isinstance(pattern, unicode) and not isinstance(dirname, unicode): - dirname = unicode(dirname, sys.getfilesystemencoding()) try: names = os.listdir(dirname) except os.error: return [] - if pattern[0] != '.': - names = filter(lambda x: x[0] != '.', names) - return fnmatch.filter(names, pattern) + if pattern[0]!='.': + names=filter(lambda x: x[0]!='.',names) + return fnmatch.filter(names,pattern) def glob0(dirname, basename): if basename == '': diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py index f1993ab..5ce09f9 100644 --- a/Lib/test/test_glob.py +++ b/Lib/test/test_glob.py @@ -52,16 +52,6 @@ class GlobTests(unittest.TestCase): eq(self.glob('aab'), [self.norm('aab')]) eq(self.glob('zymurgy'), []) - # test return types are unicode, but only if os.listdir - # returns unicode filenames - uniset = set([unicode]) - tmp = os.listdir(u'.') - if set(type(x) for x in tmp) == uniset: - u1 = glob.glob(u'*') - u2 = glob.glob(u'./*') - self.assertEquals(set(type(r) for r in u1), uniset) - self.assertEquals(set(type(r) for r in u2), uniset) - def test_glob_one_directory(self): eq = self.assertSequencesEqual_noorder eq(self.glob('a*'), map(self.norm, ['a', 'aab', 'aaa'])) |