summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrent Nelson <trent@trent.me>2012-08-29 09:20:41 -0400
committerTrent Nelson <trent@trent.me>2012-08-29 09:20:41 -0400
commitda4277a739bab61e79dc4d064b1e1648ddd59150 (patch)
tree6daf98ae796f894cca8901f72ed12797c5a2b58c
parent23d49d3e7e386bb2b26d5b944fc123f0f21ce0a6 (diff)
downloadcpython-git-da4277a739bab61e79dc4d064b1e1648ddd59150.tar.gz
Issue #15765: Fix quirky NetBSD getcwd() behaviour.
This is done by extending a previous fix for issue #9185 that was made for Solaris and OpenBSD to NetBSD as well.
-rw-r--r--Lib/test/test_posix.py12
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/posixmodule.c4
3 files changed, 16 insertions, 3 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 755a81c350..2eba77043e 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -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('..')
diff --git a/Misc/NEWS b/Misc/NEWS
index 54c260c660..1b7f80f01a 100644
--- 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.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 1bd5c1ac68..ea810ecaea 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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)