From 7a32e5a07a728a20e6c9e17b1a94ca138b24aeb2 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Sun, 22 Sep 2019 16:35:00 +0100 Subject: [PATCH] Fix incorrect import in Python 3.7+ It turns out that the import of `contextlib.nullcontext` in Python 3.7+ was accidentally trying to import `contextmanager.nullcontext`, but this was never noticed because it simply fell back to the backport included here. I do not know of a great way to test this that doesn't rely on implementation details, but I have manually tested it by setting a breakpoint after the import in the `try` statement and importing `dateutil.tz` manually on Python 3.7, so this version should work. --- dateutil/tz/tz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dateutil/tz/tz.py b/dateutil/tz/tz.py index 9d64c37a9..2460b5ed5 100644 --- a/dateutil/tz/tz.py +++ b/dateutil/tz/tz.py @@ -1823,7 +1823,7 @@ def _get_supported_offset(second_offset): try: # Python 3.7 feature - from contextmanager import nullcontext as _nullcontext + from contextlib import nullcontext as _nullcontext except ImportError: class _nullcontext(object): """