Should PyImport_ImportModule be threadsafe when importing from zipfiles?

Geoff Bache geoff.bache at gmail.com
Fri Feb 21 02:55:53 EST 2020


I'm not sure I understand what you mean by "stick something" there. What
did you have in mind? I can't just put anything there or the importing will
fail anyhow.
Also, setting the module back into there afterwards isn't possible unless
I've already imported it, and as mentioned I can't do that in practice.

/Geoff

On Thu, Feb 20, 2020 at 6:59 PM Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Feb 21, 2020 at 3:06 AM Geoff Bache <geoff.bache at gmail.com> wrote:
> >
> > Hi Chris,
> >
> > Yes, I've tried both of these things already. I can confirm there are
> multiple calls, and that pre-importing the module fixes it. But
> pre-importing it is not a solution in practice.
> >
>
> Cool, good to know.
>
> Crazy idea: What would happen if you stick something temporarily into
> sys.modules["b"], then when you're done importing, set the module back
> into there? Might not help, but would be interesting to try, and might
> show a bit more of what's going on.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list