Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-18 Thread Arnaud Fontaine
Antoine Pitrou writes: > Le Wed, 14 Aug 2013 14:17:59 +0900, Arnaud Fontaine > a écrit : >> From my understanding of import.c source code, until something is >> added to sys.modules or the code loaded, there should be no >> side-effect to releasing the lock, right? (eg there is no global >> vari

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-14 Thread Antoine Pitrou
Le Wed, 14 Aug 2013 14:17:59 +0900, Arnaud Fontaine a écrit : > Antoine Pitrou writes: > > > Le Tue, 13 Aug 2013 17:28:42 +0900, Arnaud Fontaine > > a écrit : > >> Yes. Actually, I was thinking about implementing something similar > >> to what has been done in Python 3.3 but for Python 2.7 with

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-14 Thread Arnaud Fontaine
Antoine Pitrou writes: > Le Tue, 13 Aug 2013 17:28:42 +0900, Arnaud Fontaine > a écrit : >> Yes. Actually, I was thinking about implementing something similar to >> what has been done in Python 3.3 but for Python 2.7 with a >> corser-grain lock. From my understanding of import.c, it should work

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-13 Thread Antoine Pitrou
Le Tue, 13 Aug 2013 17:28:42 +0900, Arnaud Fontaine a écrit : > Antoine Pitrou writes: > > On Tue, 13 Aug 2013 11:06:51 +0900 Arnaud Fontaine > > wrote: > >> I suggested the same in my initial email, but I was wondering if > >> there could be any issue by releasing the lock in > >> find_module()

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-13 Thread Arnaud Fontaine
Antoine Pitrou writes: > On Tue, 13 Aug 2013 11:06:51 +0900 Arnaud Fontaine > wrote: >> I suggested the same in my initial email, but I was wondering if there >> could be any issue by releasing the lock in find_module()/load_module() >> until the module is actually added to sys.modules. > > Well

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-13 Thread Brett Cannon
On Mon, Aug 12, 2013 at 10:10 PM, Arnaud Fontaine < arnaud.fonta...@nexedi.com> wrote: > Brett Cannon writes: > > On Mon, Aug 12, 2013 at 5:12 AM, Arnaud Fontaine < > arnaud.fonta...@nexedi.com wrote: > >> Yes, I saw the bug report and its patch implementing the import lock per > >> module (menti

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Antoine Pitrou
On Tue, 13 Aug 2013 11:06:51 +0900 Arnaud Fontaine wrote: > Hi, > > Armin Rigo writes: > > On Mon, Aug 12, 2013 at 9:39 AM, Arnaud Fontaine > > wrote: > >> Thread 1 is trying to import a module 'foo.bar' (where 'foo' is a > >> package containing dynamic modules) handled by Import Hooks I >

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Arnaud Fontaine
Brett Cannon writes: > On Mon, Aug 12, 2013 at 5:12 AM, Arnaud Fontaine wrote: >> Yes, I saw the bug report and its patch implementing the import lock per >> module (mentioned in my initial email) and watched the presentation by >> Brett Cannon (BTW, I could not find the diagram explained during

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Arnaud Fontaine
Hi, Armin Rigo writes: > On Mon, Aug 12, 2013 at 9:39 AM, Arnaud Fontaine > wrote: >> Thread 1 is trying to import a module 'foo.bar' (where 'foo' is a >> package containing dynamic modules) handled by Import Hooks I >> implemented, so import lock is acquired before even running the hooks

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Brett Cannon
On Mon, Aug 12, 2013 at 5:12 AM, Arnaud Fontaine wrote: > Victor Stinner writes: > > >>I'm currently working on implementing Import Hooks (PEP302) with Python > >> 2.7 to be able to import modules whose code is in ZODB. However, I have > >> stumbled upon a widely known issue about import deadloc

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Arnaud Fontaine
Victor Stinner writes: >>I'm currently working on implementing Import Hooks (PEP302) with Python >> 2.7 to be able to import modules whose code is in ZODB. However, I have >> stumbled upon a widely known issue about import deadlock[0][1] (...) > > In Python 3.3, the import machinery has been rewr

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Armin Rigo
Hi Arnaud, On Mon, Aug 12, 2013 at 9:39 AM, Arnaud Fontaine wrote: > Thread 1 is trying to import a module 'foo.bar' (where 'foo' is a > package containing dynamic modules) handled by Import Hooks I > implemented, so import lock is acquired before even running the hooks > (Python/import.c

Re: [Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Victor Stinner
>I'm currently working on implementing Import Hooks (PEP302) with Python > 2.7 to be able to import modules whose code is in ZODB. However, I have > stumbled upon a widely known issue about import deadlock[0][1] (...) In Python 3.3, the import machinery has been rewritten (importlib is used by def

[Python-Dev] Dealing with import lock deadlock in Import Hooks

2013-08-12 Thread Arnaud Fontaine
[I initially posted this email to python-list but didn't get any reply, probably because this is too related to python core, so I'm posting it again here, hope that's ok...] Hello, I'm currently working on implementing Import Hooks (PEP302) with Python 2.7 to be able to import modules whose code