Synchronize handling of datetime in Packer implementations (#434)

The handling of datetime is different in the cython and Python implementations. In contrast to the docs, timezone is not required in the Python implementation.
This commit is contained in:
Peter Fischer 2020-07-24 09:29:15 +02:00 committed by GitHub
parent 5614dd5a89
commit 772c830841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -921,7 +921,7 @@ class Packer(object):
len(obj), dict_iteritems(obj), nest_limit - 1
)
if self._datetime and check(obj, _DateTime):
if self._datetime and check(obj, _DateTime) and obj.tzinfo is not None:
obj = Timestamp.from_datetime(obj)
default_used = 1
continue