(cls, year, month=None, day=None, hour=0, minute=0, second=0,
microsecond=0, tzinfo=None, *, fold=0)
| 1671 | __slots__ = date.__slots__ + time.__slots__ |
| 1672 | |
| 1673 | def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0, |
| 1674 | microsecond=0, tzinfo=None, *, fold=0): |
| 1675 | if (isinstance(year, (bytes, str)) and len(year) == 10 and |
| 1676 | 1 <= ord(year[2:3])&0x7F <= 12): |
| 1677 | # Pickle support |
| 1678 | if isinstance(year, str): |
| 1679 | try: |
| 1680 | year = bytes(year, 'latin1') |
| 1681 | except UnicodeEncodeError: |
| 1682 | # More informative error message. |
| 1683 | raise ValueError( |
| 1684 | "Failed to encode latin1 string when unpickling " |
| 1685 | "a datetime object. " |
| 1686 | "pickle.load(data, encoding='latin1') is assumed.") |
| 1687 | self = object.__new__(cls) |
| 1688 | self.__setstate(year, month) |
| 1689 | self._hashcode = -1 |
| 1690 | return self |
| 1691 | year, month, day = _check_date_fields(year, month, day) |
| 1692 | hour, minute, second, microsecond, fold = _check_time_fields( |
| 1693 | hour, minute, second, microsecond, fold) |
| 1694 | _check_tzinfo_arg(tzinfo) |
| 1695 | self = object.__new__(cls) |
| 1696 | self._year = year |
| 1697 | self._month = month |
| 1698 | self._day = day |
| 1699 | self._hour = hour |
| 1700 | self._minute = minute |
| 1701 | self._second = second |
| 1702 | self._microsecond = microsecond |
| 1703 | self._tzinfo = tzinfo |
| 1704 | self._hashcode = -1 |
| 1705 | self._fold = fold |
| 1706 | return self |
| 1707 | |
| 1708 | # Read-only field accessors |
| 1709 | @property |
nothing calls this directly
no test coverage detected