]> granicus.if.org Git - python/commitdiff
Issue #17111: Prevent test_surrogates (test_fileio) failure on OS X 10.4.
authorNed Deily <nad@acm.org>
Tue, 12 Feb 2013 06:10:59 +0000 (22:10 -0800)
committerNed Deily <nad@acm.org>
Tue, 12 Feb 2013 06:10:59 +0000 (22:10 -0800)
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.

Lib/test/test_fileio.py
Misc/NEWS

index fb83255190fd9e8a263d195668685b686fea74ef..b74cec24f79a61db7a34ee4f9534dbe289518176 100644 (file)
@@ -450,8 +450,9 @@ class OtherFileTests(unittest.TestCase):
         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):
index a65c0911e7dd8b37ff7eeaf7aac0cc6613a6bcee..7acb91f2f8517dc71bee61bf8d9bc068ebc47602 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -818,6 +818,8 @@ Tests
 - 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
 -----