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

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


http://hg.python.org/cpython/rev/9458a516f769
changeset:   81315:9458a516f769
branch:      3.2
parent:      81307:95a4ff8c540b
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Jan 08 11:32:58 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
@@ -146,7 +146,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