On Wednesday, February 28, 2018 at 3:02:38 PM UTC+8, dieter wrote: > Xiang Zhang <zhangyangyu0...@gmail.com> writes: > > > Just like the title. It seems to me it is needed from the source code but > > codes in stdlib all doesn't do that. > > The "import" machinery uses locks of its own (to protect "sys.modules"). > > I assume that "load_module" will use those locks internally. > "find" might be considered to usually see quite a static situation; > should your file system be modified by concurrent threads, it might > be necessary that you use your own locks to protect against this.
I know. But my confusion is that I can't confirm your assumption. I can't find where the import lock is acquired in its code path. -- https://mail.python.org/mailman/listinfo/python-list