]> granicus.if.org Git - python/commitdiff
Issue #15765: Fix quirky NetBSD getcwd() behaviour.
authorTrent Nelson <trent@trent.me>
Wed, 29 Aug 2012 13:20:41 +0000 (09:20 -0400)
committerTrent Nelson <trent@trent.me>
Wed, 29 Aug 2012 13:20:41 +0000 (09:20 -0400)
This is done by extending a previous fix for issue #9185 that was made for
Solaris and OpenBSD to NetBSD as well.

Lib/test/test_posix.py
Misc/NEWS
Modules/posixmodule.c

index 755a81c35069d8d1fb2a24435b1c8a8ed21a07dd..2eba77043e16fda5b4fcb757e7bdc314bd062767 100644 (file)
@@ -405,8 +405,16 @@ class PosixTester(unittest.TestCase):
                             _create_and_do_getcwd(dirname, current_path_length + len(dirname) + 1)
                     except OSError as e:
                         expected_errno = errno.ENAMETOOLONG
-                        if 'sunos' in sys.platform or 'openbsd' in sys.platform:
-                            expected_errno = errno.ERANGE # Issue 9185
+                        # The following platforms have quirky getcwd()
+                        # behaviour -- see issue 9185 and 15765 for
+                        # more information.
+                        quirky_platform = (
+                            'sunos' in sys.platform or
+                            'netbsd' in sys.platform or
+                            'openbsd' in sys.platform
+                        )
+                        if quirky_platform:
+                            expected_errno = errno.ERANGE
                         self.assertEqual(e.errno, expected_errno)
                     finally:
                         os.chdir('..')
index 54c260c660a9d8c90b4893fa1177471fdd41c42f..1b7f80f01aef3d1232eae620074e76a88ba4b7e7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -346,6 +346,9 @@ Library
 Tests
 -----
 
+- Issue #15765: Extend a previous fix to Solaris and OpenBSD for quirky
+  getcwd() behaviour (issue #9185) to NetBSD as well.
+
 - Issue #15615: Add some tests for the json module's handling of invalid
   input data.  Patch by Kushal Das.
 
index 1bd5c1ac689025f7f41494184d6c52b8126249a3..ea810ecaea8fc62c89a106c8193bf15e26a9a805 100644 (file)
@@ -1956,7 +1956,9 @@ PyDoc_STRVAR(posix_getcwd__doc__,
 "getcwd() -> path\n\n\
 Return a string representing the current working directory.");
 
-#if (defined(__sun) && defined(__SVR4)) || defined(__OpenBSD__)
+#if (defined(__sun) && defined(__SVR4)) || \
+     defined(__OpenBSD__)               || \
+     defined(__NetBSD__)
 /* Issue 9185: getcwd() returns NULL/ERANGE indefinitely. */
 static PyObject *
 posix_getcwd(PyObject *self, PyObject *noargs)