[New-bugs-announce] [issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

Adrien report at bugs.python.org
Fri Nov 30 12:25:41 EST 2018

New submission from Adrien <delgan.py at gmail.com>:


I created a class inheriting from "datetime.datetime".

While creating a new instance using the classmethod "fromtimestamp" it seems to work, except if I provide a timezone object. In such case, the returned object is of base type datetime.

This looks like a bug, isn't it? If not, I guess this should be mentioned somewhere in the documentation. Tested on Python 3.6 and 3.7, my apologies if this has been fixed in 3.8.

NB: I first opened a question on SO -> https://stackoverflow.com/questions/53561996/datetime-fromtimestamp-ignores-inheritance-if-timezone-is-not-none

components: Library (Lib)
files: test.py
messages: 330811
nosy: Delgan
priority: normal
severity: normal
status: open
title: Datetime “fromtimestamp()” ignores inheritance if timezone is not None
type: behavior
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file47960/test.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list