[Python-checkins] cpython: Add a mention of the new import locks in whatsnew.

antoine.pitrou python-checkins at python.org
Thu May 17 21:16:12 CEST 2012


http://hg.python.org/cpython/rev/364289cc7891
changeset:   77018:364289cc7891
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Thu May 17 21:13:45 2012 +0200
summary:
  Add a mention of the new import locks in whatsnew.

files:
  Doc/whatsnew/3.3.rst |  17 +++++++++++++++++
  1 files changed, 17 insertions(+), 0 deletions(-)


diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -573,6 +573,23 @@
 .. XXX mention new error messages for passing wrong number of arguments to functions
 
 
+A Finer-Grained Import Lock
+===========================
+
+Previous versions of CPython have always relied on a global import lock.
+This led to unexpected annoyances, such as deadlocks when importing a module
+would trigger code execution in a different thread as a side-effect.
+Clumsy workarounds were sometimes employed, such as the
+:c:func:`PyImport_ImportModuleNoBlock` C API function.
+
+In Python 3.3, importing a module takes a per-module lock.  This correctly
+serializes importation of a given module from multiple threads (preventing
+the exposure of incompletely initialized modules), while eliminating the
+aforementioned annoyances.
+
+(contributed by Antoine Pitrou in :issue:`9260`.)
+
+
 New and Improved Modules
 ========================
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list