diff -ru Python-2.6.4.orig/Modules/posixmodule.c Python-2.6.4/Modules/posixmodule.c
--- Python-2.6.4.orig/Modules/posixmodule.c 2009-09-16 16:06:36.000000000 -0400
+++ Python-2.6.4/Modules/posixmodule.c 2009-11-02 10:31:03.000000000 -0500
@@ -3634,11 +3634,12 @@
int result;
_PyImport_AcquireLock();
pid = fork1();
+ if (pid == 0)
+ PyOS_AfterFork();
+
result = _PyImport_ReleaseLock();
if (pid == -1)
return posix_error();
- if (pid == 0)
- PyOS_AfterFork();
if (result < 0) {
/* Don't clobber the OSError if the fork failed. */
PyErr_SetString(PyExc_RuntimeError,
@@ -3663,11 +3664,12 @@
int result;
_PyImport_AcquireLock();
pid = fork();
+ if (pid == 0)
+ PyOS_AfterFork();
+
result = _PyImport_ReleaseLock();
if (pid == -1)
return posix_error();
- if (pid == 0)
- PyOS_AfterFork();
if (result < 0) {
/* Don't clobber the OSError if the fork failed. */
PyErr_SetString(PyExc_RuntimeError,
@@ -3781,11 +3783,12 @@
_PyImport_AcquireLock();
pid = forkpty(&master_fd, NULL, NULL, NULL);
+ if (pid == 0)
+ PyOS_AfterFork();
+
result = _PyImport_ReleaseLock();
if (pid == -1)
return posix_error();
- if (pid == 0)
- PyOS_AfterFork();
if (result < 0) {
/* Don't clobber the OSError if the fork failed. */
PyErr_SetString(PyExc_RuntimeError,
diff -ru Python-2.6.4.orig/Python/import.c Python-2.6.4/Python/import.c
--- Python-2.6.4.orig/Python/import.c 2009-09-16 16:06:36.000000000 -0400
+++ Python-2.6.4/Python/import.c 2009-11-02 10:38:09.000000000 -0500
@@ -303,9 +303,10 @@
void
_PyImport_ReInitLock(void)
{
-#ifdef _AIX
+#if defined(_AIX) || (defined (__SVR4) && defined (__sun))
if (import_lock != NULL)
import_lock = PyThread_allocate_lock();
+ import_lock_thread = PyThread_get_thread_ident();
#endif
}
Only in Python-2.6.4/Python: import.c~