Patrik Simons added the comment:

list(sys.modules.items()) still raises RuntimeError: dictionary changed size 
during iteration when another thread imports a module.

I would assume dict.copy() is thread-safe so a working fix could use 

I hit this bug when printing the name of the caller function using
inspect.stack(). The workaround in this case is calling 

nosy: +psimons

Python tracker <>
Python-bugs-list mailing list

Reply via email to