Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-bson for openSUSE:Factory 
checked in at 2024-11-17 16:39:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-bson (Old)
 and      /work/SRC/openSUSE:Factory/.python-bson.new.2017 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-bson"

Sun Nov 17 16:39:43 2024 rev:7 rq:1224439 version:0.5.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-bson/python-bson.changes  2024-01-03 
12:27:04.916066449 +0100
+++ /work/SRC/openSUSE:Factory/.python-bson.new.2017/python-bson.changes        
2024-11-17 16:40:00.284256883 +0100
@@ -1,0 +2,5 @@
+Thu Nov 14 20:23:54 UTC 2024 - Bernhard Wiedemann <bwiedem...@suse.com>
+
+- Add fix2038.patch to fix an issue with year 2038
+
+-------------------------------------------------------------------

New:
----
  fix2038.patch

BETA DEBUG BEGIN:
  New:
- Add fix2038.patch to fix an issue with year 2038
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-bson.spec ++++++
--- /var/tmp/diff_new_pack.A7JsZx/_old  2024-11-17 16:40:01.572310385 +0100
+++ /var/tmp/diff_new_pack.A7JsZx/_new  2024-11-17 16:40:01.584310884 +0100
@@ -28,6 +28,7 @@
 Patch0:         drop-python2-support.patch
 # PATCH-FIX-OPENSUSE Use assertEqual to support Python 3.12
 Patch1:         support-python312.patch
+Patch2:         fix2038.patch
 BuildRequires:  %{python_module pip}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  %{python_module wheel}

++++++ fix2038.patch ++++++
Index: bson-0.5.8/bson/objectid.py
===================================================================
--- bson-0.5.8.orig/bson/objectid.py
+++ bson-0.5.8/bson/objectid.py
@@ -158,7 +158,7 @@ class ObjectId(object):
             generation_time = generation_time - generation_time.utcoffset()
         timestamp = calendar.timegm(generation_time.timetuple())
         oid = struct.pack(
-            ">i", int(timestamp)) + b"\x00\x00\x00\x00\x00\x00\x00\x00"
+            ">L", int(timestamp) & 0xFFFFFFFF) + 
b"\x00\x00\x00\x00\x00\x00\x00\x00"
         return cls(oid)
 
     @classmethod
@@ -184,7 +184,7 @@ class ObjectId(object):
         """
 
         # 4 bytes current time
-        oid = struct.pack(">i", int(time.time()))
+        oid = struct.pack(">L", int(time.time()) & 0xFFFFFFFF)
 
         # 3 bytes machine
         oid += ObjectId._machine_bytes
Index: bson-0.5.8/bson/tests/test_objectid.py
===================================================================
--- bson-0.5.8.orig/bson/tests/test_objectid.py
+++ bson-0.5.8/bson/tests/test_objectid.py
@@ -522,7 +522,7 @@ class TestObjectId(unittest.TestCase):
         if 'PyPy 1.8.0' in sys.version:
             # See https://bugs.pypy.org/issue1092
             raise SkipTest("datetime.timedelta is broken in pypy 1.8.0")
-        d = datetime.datetime.utcnow()
+        d = datetime.datetime.utcfromtimestamp(2000000000)
         d = d - datetime.timedelta(microseconds=d.microsecond)
         oid = ObjectId.from_datetime(d)
         self.assertEqual(d, oid.generation_time.replace(tzinfo=None))

Reply via email to