[Python-Dev] Dealing with import lock deadlock in Import Hooks
Arnaud Fontaine
arnaud.fontaine at nexedi.com
Wed Aug 14 07:17:59 CEST 2013
Antoine Pitrou <solipsis at pitrou.net> writes:
> Le Tue, 13 Aug 2013 17:28:42 +0900, Arnaud Fontaine <arnaud.fontaine at nexedi.com> 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
>> but I was hoping that someone with more experience in import code
>> would confirm:
>
> It's probably possible, but it will be non-trivial and delicate to get
> right.
>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 variables/data being
shared for importing modules, meaning that releasing the lock should be
safe as long as the modules loaded through import hooks are protected by
a lock)
>> Also, if a patch backporting the features from Python 3.3 to import.c
>> for Python 2.7 would be written, is there any chance it could be
>> accepted?
>
> Definitely not. We generally don't backport any features, especially
> when the risk is high due to a feature's implementation complexity.
I see, thanks for your answer.
Regards,
--
Arnaud Fontaine
More information about the Python-Dev
mailing list