Skip to content

Commit b4fb32d

Browse files
committed
warn about naive datetime objects
1 parent 8ce0417 commit b4fb32d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jupyter_client/jsonutil.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# Copyright (c) Jupyter Development Team.
55
# Distributed under the terms of the Modified BSD License.
66

7-
import re
87
from datetime import datetime
8+
import re
9+
import warnings
910

1011
from dateutil.parser import parse as _dateutil_parse
1112
from dateutil.tz import tzlocal
@@ -37,6 +38,9 @@ def _ensure_tzinfo(dt):
3738
"""
3839
if not dt.tzinfo:
3940
# No more naïve datetime objects!
41+
warnings.warn(u"Interpreting naïve datetime as local %s. Please add timezone info to timestamps." % dt,
42+
DeprecationWarning,
43+
stacklevel=4)
4044
dt = dt.replace(tzinfo=tzlocal())
4145
return dt
4246

0 commit comments

Comments
 (0)