Change datetime.datetime.astimezone tz argument type from timezone to tzinfo (#186)

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

This is the correct type, as quoted from astimezone's code:

    elif not isinstance(tz, tzinfo):
        raise TypeError("tz argument must be an instance of tzinfo")
This commit is contained in:
Ran Benita
2016-05-06 18:06:22 +03:00
committed by Guido van Rossum
parent c2194c9761
commit eab591bb08
2 changed files with 2 additions and 2 deletions

View File

@@ -198,7 +198,7 @@ class datetime:
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
Union[_tzinfo, bool] = ...) -> datetime: ...
def astimezone(self, tz: timezone = ...) -> datetime: ...
def astimezone(self, tz: _tzinfo = ...) -> datetime: ...
def ctime(self) -> str: ...
def isoformat(self, sep: str = ...) -> str: ...
@classmethod