Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(25)

Unified Diff: Lib/glob.py

Issue 3055: combined patches from http://bugs.python.org/issue3187 (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/branches/py3k/
Patch Set: One more tweak (fold some long lines) Created 1 year, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side by-side-diff with in-line comments
Download patch
Index: Lib/glob.py
===================================================================
--- Lib/glob.py (revision 66736)
+++ Lib/glob.py (working copy)
@@ -27,7 +27,7 @@
return
dirname, basename = os.path.split(pathname)
if not dirname:
- for name in glob1(os.curdir, basename):
+ for name in glob1(None, basename):
yield name
return
if has_magic(dirname):
@@ -48,10 +48,10 @@
def glob1(dirname, pattern):
if not dirname:
- dirname = os.curdir
- if isinstance(pattern, str) and not isinstance(dirname, str):
- dirname = str(dirname, sys.getfilesystemencoding() or
- sys.getdefaultencoding())
+ if isinstance(pattern, bytes):
+ dirname = bytes(os.curdir, 'ASCII')
+ else:
+ dirname = os.curdir
try:
names = os.listdir(dirname)
except os.error:
@@ -73,6 +73,11 @@
magic_check = re.compile('[*?[]')
+magic_check_bytes = re.compile(b'[*?[]')
def has_magic(s):
- return magic_check.search(s) is not None
+ if isinstance(s, bytes):
+ match = magic_check_bytes.search(s)
+ else:
+ match = magic_check.search(s)
+ return match is not None

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483