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

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


http://hg.python.org/cpython/rev/f6cf2985348a
changeset:   81316:f6cf2985348a
branch:      3.3
parent:      81311:1b68dc917321
parent:      81315:9458a516f769
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Jan 08 11:36:54 2013 +0200
summary:
  Issue #15845: Fix comparison between bytes and string.

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
@@ -260,7 +260,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