diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-01 04:40:36 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-01 04:40:36 (GMT) |
commit | c21d0cb6cf1c32158a37772545fb71e730ab1323 (patch) | |
tree | 834c4f78660a6d3d0a92153bc7027439b386363d /Python | |
parent | 56f1682a4462559b735c01c6cb8c06fd1afdc11b (diff) | |
download | cpython-c21d0cb6cf1c32158a37772545fb71e730ab1323.zip cpython-c21d0cb6cf1c32158a37772545fb71e730ab1323.tar.gz cpython-c21d0cb6cf1c32158a37772545fb71e730ab1323.tar.bz2 |
Merged revisions 78527,78531 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.
........
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.
........
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Python/import.c b/Python/import.c index cbfb761..43eabb8 100644 --- a/Python/import.c +++ b/Python/import.c @@ -298,15 +298,17 @@ _PyImport_ReleaseLock(void) } /* This function is called from PyOS_AfterFork to ensure that newly - created child processes do not share locks with the parent. */ + 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) { -#ifdef _AIX - if (import_lock != NULL) - import_lock = PyThread_allocate_lock(); -#endif + if (import_lock != NULL) + import_lock = PyThread_allocate_lock(); + import_lock_thread = -1; + import_lock_level = 0; } #endif |