[Python-checkins] r78556 - in python/branches/py3k: Modules/posixmodule.c

gregory.p.smith python-checkins at python.org
Mon Mar 1 18:04:46 CET 2010


Author: gregory.p.smith
Date: Mon Mar  1 18:04:45 2010
New Revision: 78556

Log:
Merged revisions 78531 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78531 | gregory.p.smith | 2010-02-28 18:31:33 -0800 (Sun, 28 Feb 2010) | 2 lines
  
  Fix for r78527.  It left out updating forkpty.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Modules/posixmodule.c

Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c	(original)
+++ python/branches/py3k/Modules/posixmodule.c	Mon Mar  1 18:04:45 2010
@@ -3880,15 +3880,18 @@
 static PyObject *
 posix_forkpty(PyObject *self, PyObject *noargs)
 {
-	int master_fd = -1, result;
+	int master_fd = -1, result = 0;
 	pid_t pid;
 
 	_PyImport_AcquireLock();
 	pid = forkpty(&master_fd, NULL, NULL, NULL);
-	if (pid == 0)
+	if (pid == 0) {
+		/* child: this clobbers and resets the import lock. */
 		PyOS_AfterFork();
-
-	result = _PyImport_ReleaseLock();
+	} else {
+		/* parent: release the import lock. */
+		result = _PyImport_ReleaseLock();
+	}
 	if (pid == -1)
 		return posix_error();
 	if (result < 0) {


More information about the Python-checkins mailing list