Skip to content

DEPR: timestamp/fromtimestamp tz-naive behavior #158139

Description

@jbrockmendel

#91384 calls for the datetime docs to be updated to say that timezone-naive datetimes are implicitly localized to the system-local timezone. Such a doc change would be misleading. Parts of the API behave that way (.timestamp, .fromtimestamp), others do not (comparisons, subtraction).

A better fix would be to choose one behavior and stick with it. Because (I assume) it is much much less, .timestamp() should be deprecated on tznaive datetime objects to either a) raise or b) behave as if the object were localized to UTC.

xref #155883 a user thinking the current behavior was a bug

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions