summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-03-01 06:18:41 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-03-01 06:18:41 (GMT)
commit24cec9fe07a1f7e408a0ff846c6491e0cf8295c4 (patch)
tree771ec4efea43ffc13b6dfb71229ec50148a70f8b /Python/import.c
parentc78d79ce30b8303a428f075770c8fcf44cd48a53 (diff)
downloadcpython-24cec9fe07a1f7e408a0ff846c6491e0cf8295c4.zip
cpython-24cec9fe07a1f7e408a0ff846c6491e0cf8295c4.tar.gz
cpython-24cec9fe07a1f7e408a0ff846c6491e0cf8295c4.tar.bz2
Merged revisions 78527,78550 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78527 | gregory.p.smith | 2010-02-28 17:22:39 -0800 (Sun, 28 Feb 2010) | 4 lines 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. ........ r78550 | gregory.p.smith | 2010-02-28 22:01:02 -0800 (Sun, 28 Feb 2010) | 2 lines Fix test to be skipped on windows. ........
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index 2640cdb..4785bca 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -295,14 +295,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