.. _useless-with-lock: useless-with-lock / W2101 ========================= **Message emitted:** ``'%s()' directly created in 'with' has no effect`` **Description:** *Used when a new lock instance is created by using with statement which has no effect. Instead, an existing instance should be used to acquire lock.* **Problematic code:** .. literalinclude:: /data/messages/u/useless-with-lock/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/u/useless-with-lock/good.py :language: python Created by the `threading `__ checker.