cpython/Python
Thomas Wouters c4dcb3801e Fix issue #1590864, multiple threads and fork() can cause deadlocks, by
acquiring the import lock around fork() calls. This prevents other threads
from having that lock while the fork happens, and is the recommended way of
dealing with such issues. There are two other locks we care about, the GIL
and the Thread Local Storage lock. The GIL is obviously held when calling
Python functions like os.fork(), and the TLS lock is explicitly reallocated
instead, while also deleting now-orphaned TLS data.

This only fixes calls to os.fork(), not extension modules or embedding
programs calling C's fork() directly. Solving that requires a new set of API
functions, and possibly a rewrite of the Python/thread_*.c mess. Add a
warning explaining the problem to the documentation in the mean time.

This also changes behaviour a little on AIX. Before, AIX (but only AIX) was
getting the import lock reallocated, seemingly to avoid this very same
problem. This is not the right approach, because the import lock is a
re-entrant one, and reallocating would do the wrong thing when forking while
holding the import lock.

Will backport to 2.6, minus the tiny AIX behaviour change.
2009-09-16 19:55:54 +00:00
..
Python-ast.c update ast version 2009-06-13 20:30:48 +00:00
_warnings.c Issue #6415: Fixed warnings.warn sagfault on bad formatted string. 2009-07-17 06:20:46 +00:00
asdl.c Merge in release25-maint r60793: 2008-06-11 07:41:16 +00:00
ast.c better col_offsets for "for" statements with tuple unpacking #6704 2009-08-15 22:59:21 +00:00
atof.c
bltinmodule.c revert r74699 since it loses useful error information 2009-09-07 13:02:15 +00:00
ceval.c small optimization: avoid popping the current block until we have to 2009-07-01 23:45:19 +00:00
codecs.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
compile.c remove tmpname support since it's no longer used 2009-06-21 23:03:36 +00:00
dup2.c
dynload_aix.c Fix SF bug #1072182, problems with signed characters. 2005-12-19 06:05:18 +00:00
dynload_atheos.c
dynload_beos.c
dynload_dl.c
dynload_hpux.c Oops, I forgot to include this file in the last commit (46046): 2006-05-19 07:05:01 +00:00
dynload_next.c Fix for 838140: don't call NSUnlinkModule when we fail to find our 2004-07-15 22:28:48 +00:00
dynload_os2.c
dynload_shlib.c Fix a warning from gcc by adding a missed const qualifier. 2006-01-04 01:30:17 +00:00
dynload_stub.c
dynload_win.c On Windows, use the Python 'Activation Context' when loading extensions 2009-01-27 23:12:23 +00:00
errors.c Add const qualifier to PyErr_SetFromErrnoWithFilename and to 2009-06-12 20:57:12 +00:00
formatter_string.c Issue #1588: Add complex.__format__. 2009-04-30 00:58:58 +00:00
formatter_unicode.c Issue #1588: Add complex.__format__. 2009-04-30 00:58:58 +00:00
frozen.c
frozenmain.c
future.c move unprefixed error into .c file 2008-10-30 23:59:18 +00:00
getargs.c - Issue #6624: yArg_ParseTuple with "s" format when parsing argument with 2009-08-01 23:54:55 +00:00
getcompiler.c
getcopyright.c welcome to 2009, Python! 2009-01-01 17:29:49 +00:00
getcwd.c Define MAXPATHLEN to be at least PATH_MAX, if that's defined. Python uses 2006-04-25 15:29:46 +00:00
getopt.c Improve -X error message. 2008-04-13 20:50:29 +00:00
getplatform.c
getversion.c
graminit.c Allow multiple context managers in one with statement, as proposed 2009-05-25 21:02:56 +00:00
import.c Fix issue #1590864, multiple threads and fork() can cause deadlocks, by 2009-09-16 19:55:54 +00:00
importdl.c
importdl.h
mactoolboxglue.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
marshal.c Move news item to correct section, remove spurious 'see below' 2009-05-13 13:07:14 +00:00
modsupport.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
mysnprintf.c Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is 2008-05-26 22:07:28 +00:00
mystrtoul.c Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings. 2008-03-28 04:58:51 +00:00
peephole.c Fix error handling in PyCode_Optimize, by Alexander Schremmer at EuroPython sprint. 2009-06-29 14:44:49 +00:00
pyarena.c Fix more memory allocation issues found with failmalloc. 2006-07-22 16:20:49 +00:00
pyctype.c Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors. 2009-04-27 19:04:37 +00:00
pyfpe.c
pymath.c Backport r71704 (add configure check for C99 round function) to trunk. 2009-04-18 14:41:37 +00:00
pystate.c Adds a sanity check to avoid a *very rare* infinite loop due to a corrupt tls 2008-08-04 07:33:37 +00:00
pystrcmp.c Remove compiler warnings (on Alpha at least) about using chars as 2008-03-23 06:19:57 +00:00
pystrtod.c Issue #5920: Changed format.__float__ and complex.__float__ to use a precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson. 2009-05-05 18:26:08 +00:00
pythonrun.c - Issue #3845: In PyRun_SimpleFileExFlags avoid invalid memory access with 2009-04-04 14:18:13 +00:00
sigcheck.c
strdup.c
strtod.c Remove unnecessary curly braces around an int literal. 2008-02-07 08:04:07 +00:00
structmember.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
symtable.c fix grammar 2009-06-23 01:18:57 +00:00
sysmodule.c Update docstrings for sys.getdlopenflags() and sys.setdlopenflags(). 2009-06-29 01:01:51 +00:00
thread.c Issue #4893: Use NT threading on CE. 2009-01-12 08:11:24 +00:00
thread_atheos.h
thread_beos.h
thread_cthread.h
thread_foobar.h
thread_lwp.h
thread_nt.h Issue #4893: Use NT threading on CE. 2009-01-12 08:11:24 +00:00
thread_os2.h bugfix: PyThread_start_new_thread() returns the thread ID, not a flag; 2006-07-23 13:00:04 +00:00
thread_pth.h
thread_pthread.h Patch #1454481: Make thread stack size runtime tunable. 2006-06-13 15:04:24 +00:00
thread_sgi.h Remove support for DYNIX, IRIX 4, --with-sgi-dl, --with-dl-dld 2004-01-17 04:04:13 +00:00
thread_solaris.h
thread_wince.h bug 1234979 addition 2005-07-09 15:26:33 +00:00
traceback.c revert unintended changes 2009-09-09 11:42:57 +00:00