(cls, year, month=None, day=None, hour=0, minute=0, second=0,
microsecond=0, tzinfo=None, *, fold=0)
| 1752 | __slots__ = time.__slots__ |
| 1753 | |
| 1754 | def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0, |
| 1755 | microsecond=0, tzinfo=None, *, fold=0): |
| 1756 | if (isinstance(year, (bytes, str)) and len(year) == 10 and |
| 1757 | 1 <= ord(year[2:3])&0x7F <= 12): |
| 1758 | # Pickle support |
| 1759 | if isinstance(year, str): |
| 1760 | try: |
| 1761 | year = bytes(year, 'latin1') |
| 1762 | except UnicodeEncodeError: |
| 1763 | # More informative error message. |
| 1764 | raise ValueError( |
| 1765 | "Failed to encode latin1 string when unpickling " |
| 1766 | "a datetime object. " |
| 1767 | "pickle.load(data, encoding='latin1') is assumed.") |
| 1768 | self = object.__new__(cls) |
| 1769 | self.__setstate(year, month) |
| 1770 | self._hashcode = -1 |
| 1771 | return self |
| 1772 | year, month, day = _check_date_fields(year, month, day) |
| 1773 | hour, minute, second, microsecond, fold = _check_time_fields( |
| 1774 | hour, minute, second, microsecond, fold) |
| 1775 | _check_tzinfo_arg(tzinfo) |
| 1776 | self = object.__new__(cls) |
| 1777 | self._year = year |
| 1778 | self._month = month |
| 1779 | self._day = day |
| 1780 | self._hour = hour |
| 1781 | self._minute = minute |
| 1782 | self._second = second |
| 1783 | self._microsecond = microsecond |
| 1784 | self._tzinfo = tzinfo |
| 1785 | self._hashcode = -1 |
| 1786 | self._fold = fold |
| 1787 | return self |
| 1788 | |
| 1789 | # Read-only field accessors |
| 1790 | @property |
nothing calls this directly
no test coverage detected