From 88637064b3118f90ae5a402e1b47a243ef88d656 Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Wed, 11 Dec 2019 17:59:49 +0500 Subject: [PATCH] Refs #28373 -- Stopped setting tzinfo in typecast_timestamp(). Unnecessary since cef3f2d3c64055c9fc1757fd61dba24b557a2add. When USE_TZ=True, conn_tznames is always passed to methods that use typecast_timestamp(). Therefore, it can return naive datetimes. --- django/db/backends/utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py index 2416a458bac..50db0930204 100644 --- a/django/db/backends/utils.py +++ b/django/db/backends/utils.py @@ -6,9 +6,7 @@ import logging import time from contextlib import contextmanager -from django.conf import settings from django.db.utils import NotSupportedError -from django.utils.timezone import utc logger = logging.getLogger('django.db.backends') @@ -170,11 +168,10 @@ def typecast_timestamp(s): # does NOT store time zone information seconds, microseconds = seconds.split('.') else: microseconds = '0' - tzinfo = utc if settings.USE_TZ else None return datetime.datetime( int(dates[0]), int(dates[1]), int(dates[2]), int(times[0]), int(times[1]), int(seconds), - int((microseconds + '000000')[:6]), tzinfo + int((microseconds + '000000')[:6]) )