Brett Cannon <br...@python.org> added the comment:
On Wed, Jul 14, 2010 at 12:34, Antoine Pitrou <rep...@bugs.python.org>wrote:
>
> Antoine Pitrou <pit...@free.fr> added the comment:
>
> > So I say we don't worry about loaders being thread-safe. If __import__
> > handles the locking for a specific module then it will hold the lock
> > on behalf of the loader.
>
> Yes but what happens if two different modules are imported from two
> different threads, and handled by the same loader? The loader could have
> global structures which rely on serialization of imports for
> consistency.
>
That's why I said we should supply a context decorator (or function) which
will handle the lock appropriately, taking the name of the module to import
as an argument so the locking is fine-grained.
----------
Added file: http://bugs.python.org/file18005/unnamed
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9260>
_______________________________________
<br><br><div class="gmail_quote">On Wed, Jul 14, 2010 at 12:34, Antoine Pitrou
<span dir="ltr"><<a
href="mailto:rep...@bugs.python.org">rep...@bugs.python.org</a>></span>
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Antoine Pitrou <<a href="mailto:pit...@free.fr">pit...@free.fr</a>> added
the comment:<br>
<div class="im"><br>
> So I say we don't worry about loaders being thread-safe. If
__import__<br>
> handles the locking for a specific module then it will hold the lock<br>
> on behalf of the loader.<br>
<br>
</div>Yes but what happens if two different modules are imported from two<br>
different threads, and handled by the same loader? The loader could have<br>
global structures which rely on serialization of imports for<br>
consistency.<br></blockquote><div><br></div><div>That's why I said we
should supply a context decorator (or function) which will handle the lock
appropriately, taking the name of the module to import as an argument so the
locking is fine-grained.</div>
</div>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com