jjames pushed to python-persistent (f22). "Add -timestamp patch to fix test failures."

notifications at fedoraproject.org notifications at fedoraproject.org
Wed Apr 15 01:03:49 UTC 2015


>From e25cd19f6f5a6bedb1d1c09c363d53309c3de0d3 Mon Sep 17 00:00:00 2001
From: Jerry James <loganjerry at gmail.com>
Date: Tue, 14 Apr 2015 17:24:07 -0600
Subject: Add -timestamp patch to fix test failures.


diff --git a/python-persistent-timestamp.patch b/python-persistent-timestamp.patch
new file mode 100644
index 0000000..022441d
--- /dev/null
+++ b/python-persistent-timestamp.patch
@@ -0,0 +1,60 @@
+--- ./persistent/tests/test_timestamp.py.orig	2015-04-08 08:51:03.000000000 -0600
++++ ./persistent/tests/test_timestamp.py	2015-04-14 17:14:14.327905968 -0600
+@@ -13,6 +13,7 @@
+ ##############################################################################
+ import operator
+ import unittest
++from ctypes import c_long
+ 
+ class Test__UTC(unittest.TestCase):
+ 
+@@ -269,24 +270,24 @@ class PyAndCComparisonTests(unittest.Tes
+         self.assertEqual(hash(c), hash(py))
+ 
+         c, py = self._make_C_and_Py(b'\x00\x00\x00\x00\x00\x01\x00\x00')
+-        self.assertEqual(hash(c), 1000006000001)
++        self.assertEqual(hash(c), c_long(1000006000001).value)
+         self.assertEqual(hash(c), hash(py))
+ 
+         c, py = self._make_C_and_Py(b'\x00\x00\x00\x00\x01\x00\x00\x00')
+-        self.assertEqual(hash(c), 1000009000027000019)
++        self.assertEqual(hash(c), c_long(1000009000027000019).value)
+         self.assertEqual(hash(c), hash(py))
+ 
+         # Overflow kicks in at this point
+         c, py = self._make_C_and_Py(b'\x00\x00\x00\x01\x00\x00\x00\x00')
+-        self.assertEqual(hash(c), -4442925868394654887)
++        self.assertEqual(hash(c), c_long(-4442925868394654887).value)
+         self.assertEqual(hash(c), hash(py))
+ 
+         c, py = self._make_C_and_Py(b'\x00\x00\x01\x00\x00\x00\x00\x00')
+-        self.assertEqual(hash(c), -3993531167153147845)
++        self.assertEqual(hash(c), c_long(-3993531167153147845).value)
+         self.assertEqual(hash(c), hash(py))
+ 
+         c, py = self._make_C_and_Py(b'\x01\x00\x00\x00\x00\x00\x00\x00')
+-        self.assertEqual(hash(c), -3099646879006235965)
++        self.assertEqual(hash(c), c_long(-3099646879006235965).value)
+         self.assertEqual(hash(c), hash(py))
+ 
+     def test_ordering(self):
+--- ./persistent/timestamp.py.orig	2015-04-08 08:47:04.000000000 -0600
++++ ./persistent/timestamp.py	2015-04-14 17:13:34.247960122 -0600
+@@ -13,7 +13,7 @@
+ ##############################################################################
+ __all__ = ('TimeStamp',)
+ 
+-from ctypes import c_int64
++from ctypes import c_long
+ import datetime
+ import math
+ import struct
+@@ -158,7 +158,7 @@ class pyTimeStamp(object):
+ 
+         # Make sure to overflow and wraparound just
+         # like the C code does.
+-        x = c_int64(x).value
++        x = c_long(x).value
+         if x == -1: #pragma: no cover
+             # The C version has this condition, but it's not clear
+             # why; it's also not immediately obvious what bytestring
diff --git a/python-persistent.spec b/python-persistent.spec
index f70ae47..54f0a73 100644
--- a/python-persistent.spec
+++ b/python-persistent.spec
@@ -12,6 +12,8 @@ Summary:        Translucent persistent python objects
 License:        ZPLv2.1
 URL:            http://www.zodb.org/
 Source0:        https://pypi.python.org/packages/source/p/%{pkgname}/%{pkgname}-%{version}.tar.gz
+# Fix timestamp hash codes on 32-bit platforms
+Patch0:         %{name}-timestamp.patch
 
 BuildRequires:  python-devel
 BuildRequires:  python-nose
@@ -87,6 +89,10 @@ Documentation for %{name}.
 %prep
 %setup -q -c
 
+pushd %{pkgname}-%{version}
+%patch0
+popd
+
 # Remove prebuilt egg and documentation
 rm -fr %{pkgname}-%{version}/%{pkgname}.egg-info \
   %{pkgname}-%{version}/docs/_build
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/python-persistent.git/commit/?h=f22&id=e25cd19f6f5a6bedb1d1c09c363d53309c3de0d3


More information about the scm-commits mailing list