Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-26 Thread Brett Cannon
On 10/25/07, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2007/10/25, Facundo Batista <[EMAIL PROTECTED]>: > > > BTW, I'll leave the optimization of importing strptime one time, > > there's no reason to try to import it everytime strptime() is called. > > No, I'm not. In consideration to the possib

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-25 Thread Facundo Batista
2007/10/25, Facundo Batista <[EMAIL PROTECTED]>: > BTW, I'll leave the optimization of importing strptime one time, > there's no reason to try to import it everytime strptime() is called. No, I'm not. In consideration to the possible warning raised by Brett, I won't commit the change (it does not

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-25 Thread Facundo Batista
2007/10/20, Nick Coghlan <[EMAIL PROTECTED]>: > bb.py is broken - importing a module should never spawn a new thread as > a side effect (precisely because it will deadlock if the spawned thread > tries to do an import, which can happen in a myriad of ways). Exactly, :(. I changed timeobject.c to

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-20 Thread Brett Cannon
On 10/20/07, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2007/10/19, Christian Heimes <[EMAIL PROTECTED]>: > > > I know a possible solution. You could write a patch that moves the > > imports in C code to the module init function and stores the modules in > > a global static variable. > > I though

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-20 Thread Facundo Batista
2007/10/20, Nick Coghlan <[EMAIL PROTECTED]>: > bb.py is broken - importing a module should never spawn a new thread as > a side effect (precisely because it will deadlock if the spawned thread > tries to do an import, which can happen in a myriad of ways). Agreed. But if we move the import of t

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-20 Thread Facundo Batista
2007/10/19, Christian Heimes <[EMAIL PROTECTED]>: > I know a possible solution. You could write a patch that moves the > imports in C code to the module init function and stores the modules in > a global static variable. I thought about this. It even will have the good side efect of not shooting

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-19 Thread Nick Coghlan
Facundo Batista wrote: > Hi! > > I was looking to this bug: http://bugs.python.org/issue1255 > > It basically creates a deadlock in Python by doing the following: > > - aa.py imports bb.py > - bb.py imports time and generates a thread bb.py is broken - importing a module should never spawn a

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-19 Thread Christian Heimes
Facundo Batista wrote: > What I did *not* find, and why I'm asking here, is how to solve it. > > Exists a known solution to this? I know a possible solution. You could write a patch that moves the imports in C code to the module init function and stores the modules in a global static variable. C

Re: [Python-Dev] Deadlock by a second import in a thread

2007-10-19 Thread Adam Olsen
On 10/19/07, Facundo Batista <[EMAIL PROTECTED]> wrote: > Hi! > > I was looking to this bug: http://bugs.python.org/issue1255 > > It basically creates a deadlock in Python by doing the following: > > - aa.py imports bb.py > - bb.py imports time and generates a thread > - the thread uses time.strp