[Python-checkins] cpython (merge 3.3 -> default): Issue #15845: Fix comparison between bytes and string.

serhiy.storchaka python-checkins at python.org
Tue Jan 8 10:41:14 CET 2013


http://hg.python.org/cpython/rev/51e60d9ee389
changeset:   81317:51e60d9ee389
parent:      81314:ce99559efa46
parent:      81316:f6cf2985348a
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Jan 08 11:38:45 2013 +0200
summary:
  Issue #15845: Fix comparison between bytes and string.
Patch by Alessandro Moura.

files:
  Lib/os.py |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/os.py b/Lib/os.py
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -236,7 +236,10 @@
             # be happy if someone already created the path
             if e.errno != errno.EEXIST:
                 raise
-        if tail == curdir:           # xxx/newdir/. exists if xxx/newdir exists
+        cdir = curdir
+        if isinstance(tail, bytes):
+            cdir = bytes(curdir, 'ASCII')
+        if tail == cdir:           # xxx/newdir/. exists if xxx/newdir exists
             return
     try:
         mkdir(name, mode)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list