Skip to content

datetime.datetime.astimezone should take the more general tzinfo instead of its subclass timezone #186

@bluetech

Description

@bluetech

timezone inherits from tzinfo, so using tzinfo is more general (and e.g. pytz types inherit directly from tzinfo).

This is the correct type, to quote astimezone's code:

elif not isinstance(tz, tzinfo):
    raise TypeError("tz argument must be an instance of tzinfo")

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