[pypy-commit] pypy default: speed up unpickling of datetime.time objects

justinpeel noreply at buildbot.pypy.org
Sat Mar 3 22:12:09 CET 2012


Author: Justin Peel <notmuchtotell at gmail.com>
Branch: 
Changeset: r53154:c3c5061a39af
Date: 2012-03-03 14:11 -0700
http://bitbucket.org/pypy/pypy/changeset/c3c5061a39af/

Log:	speed up unpickling of datetime.time objects

diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py
--- a/lib_pypy/datetime.py
+++ b/lib_pypy/datetime.py
@@ -1421,9 +1421,10 @@
     def __setstate(self, string, tzinfo):
         if len(string) != 6 or ord(string[0]) >= 24:
             raise TypeError("an integer is required")
-        self._hour, self._minute, self._second, us1, us2, us3 = \
-                                                            map(ord, string)
-        self._microsecond = (((us1 << 8) | us2) << 8) | us3
+        self._hour, self._minute, self._second = ord(string[0]), \
+                                                 ord(string[1]), ord(string[2])
+        self._microsecond = (((ord(string[3]) << 8) | \
+                            ord(string[4])) << 8) | ord(string[5])
         self._tzinfo = tzinfo
 
     def __reduce__(self):


More information about the pypy-commit mailing list