summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-03-01 01:22:39 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-03-01 01:22:39 (GMT)
commit9e5d1327f8a6f3a266b76118e0c660c7bcb12ce9 (patch)
tree32ff378ec728b89d72cad1f2669c66446b03b515 /Python
parentcce211f88c3d23bbd37f5769e3addd9b6b9fa96e (diff)
downloadcpython-9e5d1327f8a6f3a266b76118e0c660c7bcb12ce9.zip
cpython-9e5d1327f8a6f3a266b76118e0c660c7bcb12ce9.tar.gz
cpython-9e5d1327f8a6f3a266b76118e0c660c7bcb12ce9.tar.bz2
Issue #7242: On Solaris 9 and earlier calling os.fork() from within a
thread could raise an incorrect RuntimeError about not holding the import lock. The import lock is now reinitialized after fork.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index c25c4f0..eb50bc5 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -301,14 +301,18 @@ _PyImport_ReleaseLock(void)
return 1;
}
-/* This function used to be called from PyOS_AfterFork to ensure that newly
- created child processes do not share locks with the parent, but for some
- reason only on AIX systems. Instead of re-initializing the lock, we now
- acquire the import lock around fork() calls. */
+/* This function is called from PyOS_AfterFork to ensure that newly
+ created child processes do not share locks with the parent.
+ We now acquire the import lock around fork() calls but on some platforms
+ (Solaris 9 and earlier? see isue7242) that still left us with problems. */
void
_PyImport_ReInitLock(void)
{
+ if (import_lock != NULL)
+ import_lock = PyThread_allocate_lock();
+ import_lock_thread = -1;
+ import_lock_level = 0;
}
#endif