Author: Carl Friedrich Bolz-Tereick <cfb...@gmx.de>
Branch: 2634_datetime_timedelta_performance
Changeset: r93737:2a0f482a854d
Date: 2018-02-02 13:33 +0100
http://bitbucket.org/pypy/pypy/changeset/2a0f482a854d/

Log:    modify __new__ less invasively

diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py
--- a/lib_pypy/datetime.py
+++ b/lib_pypy/datetime.py
@@ -1415,15 +1415,11 @@
         elif isinstance(year, tuple) and len(year) == 7:
             # Used by internal functions where the arguments are guaranteed to
             # be valid.
-            self = object.__new__(cls)
-            self._year, self._month, self._day, self._hour, self._minute, \
-                self._second, self._microsecond = year
-            self._tzinfo = tzinfo
-            self._hashcode = -1
-            return self
-        year, month, day = _check_date_fields(year, month, day)
-        hour, minute, second, microsecond = _check_time_fields(
-            hour, minute, second, microsecond)
+            year, month, day, hour, minute, second, microsecond = year
+        else:
+            year, month, day = _check_date_fields(year, month, day)
+            hour, minute, second, microsecond = _check_time_fields(
+                hour, minute, second, microsecond)
         _check_tzinfo_arg(tzinfo)
         self = object.__new__(cls)
         self._year = year
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to