[pypy-commit] pypy py3k: port some datetime changes from 72e79a8305c7

bdkearns noreply at buildbot.pypy.org
Tue Mar 5 05:15:03 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: py3k
Changeset: r62047:a94c76ff11ca
Date: 2013-03-04 22:30 -0500
http://bitbucket.org/pypy/pypy/changeset/a94c76ff11ca/

Log:	port some datetime changes from 72e79a8305c7

diff --git a/lib-python/3/datetime.py b/lib-python/3/datetime.py
--- a/lib-python/3/datetime.py
+++ b/lib-python/3/datetime.py
@@ -1028,13 +1028,14 @@
         second, microsecond (default to zero)
         tzinfo (default to None)
         """
-        self = object.__new__(cls)
         if isinstance(hour, bytes) and len(hour) == 6:
             # Pickle support
+            self = object.__new__(cls)
             self.__setstate(hour, minute or None)
             return self
         _check_tzinfo_arg(tzinfo)
         _check_time_fields(hour, minute, second, microsecond)
+        self = object.__new__(cls)
         self._hour = hour
         self._minute = minute
         self._second = second
@@ -1319,9 +1320,13 @@
             self = date.__new__(cls, year[:4])
             self.__setstate(year, month)
             return self
+        _check_date_fields(year, month, day)
+        _check_time_fields(hour, minute, second, microsecond)
         _check_tzinfo_arg(tzinfo)
-        _check_time_fields(hour, minute, second, microsecond)
-        self = date.__new__(cls, year, month, day)
+        self = object.__new__(cls)
+        self._year = year
+        self._month = month
+        self._day = day
         self._hour = hour
         self._minute = minute
         self._second = second


More information about the pypy-commit mailing list