Index: Lib/test/test_posix.py =================================================================== --- Lib/test/test_posix.py (revision 88430) +++ Lib/test/test_posix.py (working copy) @@ -357,7 +357,7 @@ _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: + if 'sunos' in sys.platform or 'openbsd' in sys.platform or 'netbsd' in sys.platform: expected_errno = errno.ERANGE # Issue 9185 self.assertEqual(e.errno, expected_errno) finally: Index: Modules/posixmodule.c =================================================================== --- Modules/posixmodule.c (revision 88430) +++ Modules/posixmodule.c (working copy) @@ -1958,7 +1958,7 @@ "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)