[Python-checkins] cpython (2.7): Issue #17111: Prevent test_surrogates (test_fileio) failure on OS X 10.4.

ned.deily python-checkins at python.org
Tue Feb 12 07:11:39 CET 2013


http://hg.python.org/cpython/rev/9497adb7355f
changeset:   82169:9497adb7355f
branch:      2.7
parent:      82165:e44fa71d76fe
user:        Ned Deily <nad at acm.org>
date:        Mon Feb 11 22:10:59 2013 -0800
summary:
  Issue #17111: Prevent test_surrogates (test_fileio) failure on OS X 10.4.

An odd bug in OS X 10.4 causes open(2) on a non-existent,
invalid-encoded filename to return errno 22, EINVAL: Invalid argument,
instead of the expected errno 2, ENOENT: No such file or directory,
*if* the containing directory is not empty.  That caused frequent
failures when running the buildbot tests on 10.4 depending on the state
of the test working directory.  The failure is easy to reproduce on
10.4 by running the test directly (not with regrtest), first in an empty
directory, then after adding a file to it.  The fix is to check for and
pass if either errno is returned.

files:
  Lib/test/test_fileio.py |  5 +++--
  Misc/NEWS               |  2 ++
  2 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -450,8 +450,9 @@
         env = dict(os.environ)
         env[b'LC_CTYPE'] = b'C'
         _, out = run_python('-c', 'import _io; _io.FileIO(%r)' % filename, env=env)
-        if ('UnicodeEncodeError' not in out and
-            'IOError: [Errno 2] No such file or directory' not in out):
+        if ('UnicodeEncodeError' not in out and not
+                ( ('IOError: [Errno 2] No such file or directory' in out) or
+                  ('IOError: [Errno 22] Invalid argument' in out) ) ):
             self.fail('Bad output: %r' % out)
 
     def testUnclosedFDOnException(self):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -818,6 +818,8 @@
 - Issue #16698: Skip posix test_getgroups when built with OS X
   deployment target prior to 10.6.
 
+- Issue #17111: Prevent test_surrogates (test_fileio) failure on OS X 10.4.
+
 Build
 -----
 

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


More information about the Python-checkins mailing list