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.
This commit is contained in:
Trent Nelson 2012-08-29 09:20:41 -04:00
parent 23d49d3e7e
commit da4277a739
3 changed files with 16 additions and 3 deletions

View File

@ -405,8 +405,16 @@ class PosixTester(unittest.TestCase):
_create_and_do_getcwd(dirname, current_path_length + len(dirname) + 1) _create_and_do_getcwd(dirname, current_path_length + len(dirname) + 1)
except OSError as e: except OSError as e:
expected_errno = errno.ENAMETOOLONG expected_errno = errno.ENAMETOOLONG
if 'sunos' in sys.platform or 'openbsd' in sys.platform: # The following platforms have quirky getcwd()
expected_errno = errno.ERANGE # Issue 9185 # 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) self.assertEqual(e.errno, expected_errno)
finally: finally:
os.chdir('..') os.chdir('..')

View File

@ -346,6 +346,9 @@ Library
Tests 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 - Issue #15615: Add some tests for the json module's handling of invalid
input data. Patch by Kushal Das. input data. Patch by Kushal Das.

View File

@ -1956,7 +1956,9 @@ PyDoc_STRVAR(posix_getcwd__doc__,
"getcwd() -> path\n\n\ "getcwd() -> path\n\n\
Return a string representing the current working directory."); 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. */ /* Issue 9185: getcwd() returns NULL/ERANGE indefinitely. */
static PyObject * static PyObject *
posix_getcwd(PyObject *self, PyObject *noargs) posix_getcwd(PyObject *self, PyObject *noargs)