You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2023/11/17 00:56:07 UTC

(datasketches-python) branch serde_format_fix created (now 8d8998e)

This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a change to branch serde_format_fix
in repository https://gitbox.apache.org/repos/asf/datasketches-python.git


      at 8d8998e  Update PySerDe.py

This branch includes the following new commits:

     new 8d8998e  Update PySerDe.py

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


(datasketches-python) 01/01: Update PySerDe.py

Posted by jm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch serde_format_fix
in repository https://gitbox.apache.org/repos/asf/datasketches-python.git

commit 8d8998edfbb4a5e25348c5338d7b1a15eb191dc3
Author: Jon Malkin <78...@users.noreply.github.com>
AuthorDate: Thu Nov 16 16:56:03 2023 -0800

    Update PySerDe.py
    
    Properly read/write longs as 8-bit values, based on the format table for the struct class: https://docs.python.org/3/library/struct.html#format-characters
---
 datasketches/PySerDe.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/datasketches/PySerDe.py b/datasketches/PySerDe.py
index e4de82d..9a24484 100644
--- a/datasketches/PySerDe.py
+++ b/datasketches/PySerDe.py
@@ -75,10 +75,10 @@ class PyLongsSerDe(PyObjectSerDe):
     return int(8)
 
   def to_bytes(self, item):
-    return struct.pack('<l', item)
+    return struct.pack('<q', item)
 
   def from_bytes(self, data: bytes, offset: int):
-    val = struct.unpack_from('<l', data, offset)[0]
+    val = struct.unpack_from('<q', data, offset)[0]
     return (val, 8)
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org