You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In FileHashStore, thread and multiprocessing variables (threading.Lock(), multiprocessing.Lock(), etc.) are declared outside of the __init__ process. This can create conflicts upon importing hashstore as a library, and not part of a main method in a python program (which can guard against top-level code being executed in new processes unintentionally).
This is especially true with the multiprocessing module due to the nature of how processes are spawned and initialized. Each new spawn process will re-import the module (recursive import).
These should not be declared as class variables, but determined upon instantiation instead so that it does not interfere with the initial set-up phase of the Python interpreter and its environment (ex. move them to the __init__ method).
The text was updated successfully, but these errors were encountered:
In
FileHashStore
,thread
andmultiprocessing
variables (threading.Lock()
,multiprocessing.Lock()
, etc.) are declared outside of the__init__
process. This can create conflicts upon importing hashstore as a library, and not part of amain
method in a python program (which can guard against top-level code being executed in new processes unintentionally).This is especially true with the
multiprocessing
module due to the nature of how processes are spawned and initialized. Each new spawn process will re-import the module (recursive import).These should not be declared as class variables, but determined upon instantiation instead so that it does not interfere with the initial set-up phase of the Python interpreter and its environment (ex. move them to the
__init__
method).The text was updated successfully, but these errors were encountered: