[Python-checkins] r54258 - in python/branches/release25-maint: Lib/glob.py Lib/test/test_glob.py Misc/NEWS
georg.brandl
python-checkins at python.org
Sat Mar 10 09:06:15 CET 2007
Author: georg.brandl
Date: Sat Mar 10 09:06:14 2007
New Revision: 54258
Modified:
python/branches/release25-maint/Lib/glob.py
python/branches/release25-maint/Lib/test/test_glob.py
python/branches/release25-maint/Misc/NEWS
Log:
Revert rev. 54198, it's not really backwards compatible.
Modified: python/branches/release25-maint/Lib/glob.py
==============================================================================
--- python/branches/release25-maint/Lib/glob.py (original)
+++ python/branches/release25-maint/Lib/glob.py Sat Mar 10 09:06:14 2007
@@ -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 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 == '':
Modified: python/branches/release25-maint/Lib/test/test_glob.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_glob.py (original)
+++ python/branches/release25-maint/Lib/test/test_glob.py Sat Mar 10 09:06:14 2007
@@ -52,16 +52,6 @@
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']))
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Sat Mar 10 09:06:14 2007
@@ -217,9 +217,6 @@
never made sense with ordinary subclasses -- the failure just occurred
later, with a more cumbersome exception.
-- Patch #1001604: glob.glob() now returns unicode filenames if it was
- given a unicode argument and os.listdir() returns unicode filenames.
-
- Patch #685268: Consider a package's __path__ in imputil.
- Patch 1463026: Support default namespace in XMLGenerator.
More information about the Python-checkins
mailing list