According to [1], list.pop() is thread-safe, so the lock should not be needed.
However the documentation does not say that len(list) is thread-safe.
If list.pop() does need to be protected by a lock, then surely [2] should be similarly protected?
The FAQ [1] does say that incrementing an integer is not atomic, so the various global counts might not be incremented properly.
https://github.com/apache/incubator-ponymail-foal/blob/bb4a6642506f0bb2c5a2a67570433536c3b22f66/tools/import-mbox.py#L154
According to [1], list.pop() is thread-safe, so the lock should not be needed. However the documentation does not say that len(list) is thread-safe. If list.pop() does need to be protected by a lock, then surely [2] should be similarly protected?
The FAQ [1] does say that incrementing an integer is not atomic, so the various global counts might not be incremented properly.
[1] https://docs.python.org/3/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe [2] https://github.com/apache/incubator-ponymail-foal/blob/bb4a6642506f0bb2c5a2a67570433536c3b22f66/tools/import-mbox.py#L131