.. _boolean-datetime:

boolean-datetime / W1502
========================

**Message emitted:**

Using datetime.time in a boolean context.

**Description:**

*Using datetime.time in a boolean context can hide subtle bugs when the time they represent matches midnight UTC. This behaviour was fixed in Python 3.5. See https://bugs.python.org/issue13936 for reference.*


**Correct code:**

.. literalinclude:: /data/messages/b/boolean-datetime/good.py
   :language: python

**Additional details:**

You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !


Created by the `stdlib <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/stdlib.py>`__ checker.